Back to the command reference

journalctl

SystemFundamentalsReference only

Query the systemd journal

Name: journalctl = journal control

This command is outside what the site lets you practise (mostly distribution-specific or rarely used tools). This page describes how to use it; try it on your own Linux system.

Description

journalctl queries the systemd journal, which collects logs from the kernel, services and applications. Filter by unit (-u), time (--since), priority (-p) or boot (-b), and follow with -f.

Syntax

journalctl [OPTION]...

Common options

-u / --unit UNITOnly one unit
-f / --followFollow new entries
-n / --lines NUMLast N entries
-e / --pager-endJump to the end
-r / --reverseNewest first
--since TIMESince a time, e.g. "1 hour ago"
--until TIMEUp to a time
-b / --bootOnly this boot (-b -1 is the previous one)
-k / --dmesgKernel messages only
-p errErrors only
-o / --output MODEOutput format, e.g. short-iso, json, cat
--no-pagerPrint straight out, without a pager (for pipes)
--disk-usageHow much disk the journal uses
--vacuum-size SIZEDelete old logs until they take at most SIZE, e.g. 500M

Examples

  • $ journalctl -u nginx -f

    Follow nginx logs

    Explain
  • $ journalctl --since "today" -p err

    Today's errors

    Explain

Related