Practical Usage Of journalctl

Maciej
Nov 25, 2021

Introduction

If you really forget all the options, just type journalctlto see all the saved logs, if a long line is truncated, you can scroll to the right by pressing the arrow keys

Let’s start

View recent messages

root@test:/home/ozyrys# journalctl -e

Detailed information

root@test:/home/ozyrys# journalctl -ex

Monitor logs just like tail -f

root@test:/home/ozyrys# journalctl -f

Show only messages for specific services

root@test:/home/ozyrys# journalctl -u sshd

You can specify the full path of the executable file as in.

root@test:/home/ozyrys# journalctl /usr/sbin/sshd

Display only the end of the log

root@test:/home/ozyrys# journalctl -n 100

Display all messages from startup

root@test:/home/ozyrys# journalctl -b

--

--

Maciej

DevOps Consultant. I’m strongly focused on automation, security, and reliability.