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

$journalctl

journalctl-logs1

It displays all the logs in the paginated view.



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

$journalctl -r

display-new-entry-first-journalctl

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

3. To display only a few log entries

$journalctl -n 2

display-specific-log-entries

This will display just 2 log entries.

4. To get log entries containing a specific keyword.

$journalctl | grep Centaur

specific-keyword-journalctl-grep



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

5. To display priority specific log entries.

$journalctl -p warning

priority-specific-logs-jpurnalctl

It displays all log entries with priority as a warning.

6. To print verbose customized output.

$journalctl -o verbose

journal-verbose

This will display the formatted output in verbose mode.

7. To display the boots of the system.

$journalctl --list-boots

journalctl-boots

To display all the boots of the system.

8. To display journalctl help.

$journalctl --help

journalctl-help1

journalctl-help

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

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.