journalctl Command in Linux (original) (raw)

Last Updated : 2 May, 2026

journalctl is a Linux command used to view and manage system logs maintained by the systemd-journald service. It provides a centralized and efficient way to access and analyze log data.

Let us consider an example to display all logs by journalctl command:

**Command:

journalctl

**Output:

Display all Logs

Display all Logs

Syntax:

journalctl [options] [unit]

Working with journalctl command

**1. Reversing the log order

**Command:

journalctl -r

**Output:

Reversing Logs

Reversing Logs

2. Limiting the number of log entries

If you only want to display a specific number of log entries, you can use the -n option followed by the desired number

journalctl -n 2

Limiting the number

Limiting the number

This will display just 2 log entries.

3. Filtering logs by keyword

To retrieve log entries containing a specific keyword or phrase, you can use the grep command in combination with journalctl.

journalctl | grep Centaur

Filtering Logs

Filtering Logs by keyword

This will display all the entries containing the word Centaur in them.

4. View Logs for a Specific Service

**Command:

sudo journalctl -u apache2

**Output:

file

View Logs

You can also check recent logs only:

**Command:

sudo journalctl -u apache2 -n 20

**Output:

image---2025-11-11T184214476

View Logs

Options of journalctl Command in Linux

The journalctl command provides several useful options to refine log queries and retrieve specific information. Below are some commonly used options with examples and sample outputs

1. Filtering logs by priority level

**Command:

journalctl -p warning

**Output:

Filtering logs by priorty

Filtering logs by priorty

2. Customizing output format

journalctl -o verbose

customizing output

customizing output

**3. Listing system boots

journalctl --list-boots

listning system boots

listning system boots

4. Accessing help documentation

journalctl --help

Accessing Help

Accessing Help

Setting the System Time

To set the system time using timedatectl and view the changes with journalctl, follow these steps:

sudo timedatectl set-time 'YYYY-MM-DD HH:MM:SS'

timedatectl status

journalctl --since "YYYY-MM-DD HH:MM:SS" --until "YYYY-MM-DD HH:MM:SS"

Replace YYYY-MM-DD HH:MM:SS with the appropriate time range.

Example:

Here is an example to set the time step by step in Linux

Step 1: Set the System Time

**Command:

sudo timedatectl set-time '2025-11-11 10:45:00'

**Output:

(no output — means the command succeeded)

Step 2: Verify the Change

Check the current system time:

timedatectl status

**Output:

image---2025-11-11T193857159

Verify the Change