Last active
January 20, 2025 15:48
-
-
Save sheepla/52c72432d61c81d41d3a0f55b5fed826 to your computer and use it in GitHub Desktop.
View systemd journal filter with systemd unit name with fzf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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 {})" |
Author
sheepla
commented
Sep 9, 2023

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