Skip to content

Instantly share code, notes, and snippets.

@sheepla
Last active January 20, 2025 15:48
Show Gist options
  • Select an option

  • Save sheepla/52c72432d61c81d41d3a0f55b5fed826 to your computer and use it in GitHub Desktop.

Select an option

Save sheepla/52c72432d61c81d41d3a0f55b5fed826 to your computer and use it in GitHub Desktop.
View systemd journal filter with systemd unit name with fzf
#!/bin/sh
# Requirements:
# - a system running systemd-journald service
# - fzf
# - jq
# Usage:
# journalfzf.sh UNIT_NAME_PATTERN
# Example:
# journalfzf.sh network
pattern="${1}"
systemctl list-units --output json |
jq '.[].unit | select(test($pattern))' --arg pattern "${pattern}" --raw-output |
fzf --preview "systemctl status {}" --bind "enter:execute(journalctl -u {})"
@sheepla
Copy link
Author

sheepla commented Sep 9, 2023

journalfzf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment