Display only journal entries associated with ssh.service.
Which command is appropriate?
journalctl -u UNIT filters entries by systemd unit.
Detailed explanation
journalctl -p ssh.serviceIncorrect. -p filters priority.
Incorrect. -p filters priority.
journalctl -b ssh.serviceIncorrect. -b filters boot.
Incorrect. -b filters boot.
journalctl -t ssh.serviceIncorrect. -t filters a syslog identifier or tag.
Incorrect. -t filters a syslog identifier or tag.
journalctl -u ssh.serviceCorrect. -u ssh.service selects the service's entries.
Correct. -u ssh.service selects the service's entries.
Try it yourself
An example you can run in a temporary verification environment.
journalctl --help 2>&1 | grep -E -- '--unit| -u' | head -n 1Expected result
-uまたは--unitのhelp行Key points
- -u means unit
- -p means priority
- -t means identifier
Notes
- Environment: journalctl helpの読取のみ
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.