Skip to content

Instantly share code, notes, and snippets.

@stefanlasiewski
Created May 22, 2020 01:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stefanlasiewski/4219542328ed53c8f09e59774eac169a to your computer and use it in GitHub Desktop.
Save stefanlasiewski/4219542328ed53c8f09e59774eac169a to your computer and use it in GitHub Desktop.
Use journalctl (systemd) with less, cat or tail
By default, `journalctl` will print the logs through a pager which can hide results from you. This can be annoying when trying to capture a screenshot:
root@docker01:~# journalctl -xe -u docker
May 21 23:25:40 docker01 dockerd[123]: time="2020-05-21T23:25:40.376573968Z" level=info msg="ign
May 22 00:45:37 docker01 dockerd[123]: time="2020-05-22T00:45:37.971043364Z" level=info msg="ign
lines 1006-1046/1046 (END)
Instead, pipe `journalctl` through `less`, `cat` or `tail` to quickly get familiar features such as wrapped lines:
root@docker01:~# journalctl -xe -u docker
...
May 21 23:25:40 docker01 dockerd[123]: time="2020-05-21T23:25:40.376573968Z" level=info msg="ignoring event" module=libcontainerd namespace=moby topic=/tasks/delete type="*events.TaskDelete"
May 22 00:45:37 docker01 dockerd[123]: time="2020-05-22T00:45:37.971043364Z" level=info msg="ignoring event" module=libcontainerd namespace=moby topic=/tasks/delete type="*events.TaskDelete"
(END)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment