journalctl Command in Linux with Examples

journalctl command in Linux is used to view systemd, kernal and journal logs. The logs are presented in the following way:

-- Logs begin at [date_time_stamp], end at [dat_time_stamp]
[date_time_stamp] [host_name] kernel:

It displays the paginated output, hence it is a bit easy to navigate through a lot of logs. It prints the log in the chronological order with the oldest first.

Working with journalctl command

1. To display all logs


It displays all the logs in the paginated view.

2. To reverse the order or to display the new entries first.

$journalctl -r

This will display the logs in the chronological order with the newest first.

3. To display only a few log entries

$journalctl -n 2

This will display just 2 log entries.

4. To get log entries containing a specific keyword.

$journalctl | grep Centaur

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

5. To display priority specific log entries.

$journalctl -p warning

It displays all log entries with priority as a warning.

6. To print verbose customized output.

$journalctl -o verbose

This will display the formatted output in verbose mode.

7. To display the boots of the system.

$journalctl --list-boots

To display all the boots of the system.

8. To display journalctl help.

$journalctl --help

The above command will display the help section of the journalctl command.

Article Tags :