Skip to main content

Command referencejournalctl

journalctl command (Linux / bash / sh / zsh)

Linuxbashshzshsystemintermediate

What it does

Query and follow logs stored by the systemd journal. When people search for the journalctl command linux logs, they usually want journalctl's everyday flags, safe examples, and how it differs from related tools. Below you'll find syntax, options, and copyable examples for Bash/sh/zsh.

Query and follow logs stored by the systemd journal.

Syntax

journalctl [OPTION]... [MATCH...]

Common options

Flag / optionMeaning
-u UNITShow messages for one unit.
-fFollow newly appended messages.
-bRestrict output to a boot.
--since TIMEShow entries since a date or relative time.
-p PRIORITYFilter by priority.

Practical examples

Service logs

journalctl -u nginx.service

Shows journal entries for nginx.

Follow errors

journalctl -f -p err

Streams new error-priority messages.

Current boot

journalctl -b --since '1 hour ago'

Shows recent messages from this boot.

Common mistakes

  • Running without filters and being overwhelmed by the full journal.
  • Forgetting elevated permissions may be needed to see system messages.

FAQ

What does journalctl do in Linux?

Query and follow logs stored by the systemd journal.

How do I use journalctl from the terminal?

Start with `journalctl [OPTION]... [MATCH...]`, then choose only the options needed for the task.

What is a practical journalctl example?

Try `journalctl -u nginx.service` — Shows journal entries for nginx.

Can I use journalctl in a shell script?

Yes. journalctl works in Bash, sh, and Zsh, but scripts should handle quoting, errors, and command output explicitly.

Browse the full Linux and Windows command reference to search more bash, CMD, PowerShell, Conda, and GitHub CLI commands.