# Command line: journalctl

Date: 2021-05-20 23:07:39 +08:00Date modified: 2021-09-01 22:39:16 +08:00

The logging daemon of systemd (see systemd-journald). Not only it can view your logs, you can ask to view specific logs and delete some of them.

For more information, see `journalctl.1` manual page.

# Options

- `-b, --boot [ID][+OFFSET]` shows the logs starting from given boot time (or current boot if empty).

- `-e, --pager-end` to go to the end of the logs.

- `-f, --follow` watches the logs.

- `-k, --dmesg` prints the logs from the kernel.

- `--list-boots` prints a list of boots useful for knowing the boot logs from `-b`.

- `--user-unit` shows logs from a user unit.

- `-u, --unit [UNIT]` shows the logs of a system unit.

- `--vacuum-time [TIMESPAN]` deletes logs older than the specified timespan .

- `-x, --catalog` prints helpful messages such as the documentation URIs.

# Examples

This tool is already comprehensive. Needs a comprehensive database of examples to fight against this scope.

## Watch the logs from a specific unit at boot time

    journalctl --user-unit borgbackup.service -fb

## Delete the logs older than a month

    journalctl --vacuum-time=1m

## View the latest logs with helpful messages

    journalctl -xe

## Get the logs of a service unit from 2 boots ago

    journalctl --boot -2 --user-unit borgbackup@personal-drive.service

## Backlinks

- systemd-journald