Back to commands

Linux Survival Basics

Read-only, can be slow

Read Current-Boot Logs for One Service

Old service logs can make a current incident look worse or point you at errors from last week.

Command

journalctl -u nginx -b --no-pager -n 80

Before you run this

System impact: Read-only. Can create load on large logs, directories, filesystems, or process tables.

When not to use it: Do not use for pre-reboot diagnosis; remove -b or use --since with an exact time range.

Expected output

Recent current-boot journal lines for nginx.

System impact

Read-only, can be slow. Nothing changes. journalctl prints the last 80 current-boot log entries for the unit.

Scope this to the smallest useful path or service on busy systems.

Recovery / rollback: no state is changed.

When to use it

Use after a reboot or restart when you only care about the current boot session.

When not to use it

Do not use for pre-reboot diagnosis; remove -b or use --since with an exact time range.

Watch this command run

Command transcript

This sanitized transcript shows the commands and output shape without exposing host details.

demo@lab:~$

$ journalctl -u nginx -b --no-pager -n 80

Jun 25 14:12:10 vps nginx[842]: start worker processes
Jun 25 14:12:11 vps nginx[842]: ready for connections
Jun 25 14:18:42 vps nginx[842]: reload complete

$ journalctl --disk-usage

Archived and active journals take up 412.8M in the file system.
View commands shown

These are the commands shown in the sanitized transcript.

Commands shown

  1. journalctl -u nginx -b --no-pager -n 80
  2. journalctl --disk-usage

next steps

Related commands

Linux Survival Basics Read-only

Inspect One Service Without Pager Traps

Make systemctl status safe for scripts, screenshots, and quick incident notes.

systemctl status nginx --no-pager --lines=30
Linux Survival Basics Can be slow

Spot OOM Kills in the Kernel Journal

Exit code 137 often means the kernel has something to say.

journalctl -k --since "2 hours ago" --no-pager -o short-iso | grep -Ei 'out of memory|oom|killed process'
Linux Survival Basics Can be slow

Show Only Recent Errors

The log had old failures too. I only cared about the newest ones.

grep -iE 'error|failed|denied|timeout' /var/log/nginx/error.log | tail -10
Linux Survival Basics Read-only

Print the Exact systemd Exit Fields

Turn a noisy service failure into four fields you can paste into an incident note.

systemctl show app-worker --property=Result,ExecMainCode,ExecMainStatus,NRestarts --no-pager
Study mapping

Use this as independent command practice: read the notes, predict the output, then compare it with the example before using a real shell.

  • lpic1:101-system-architecture
  • lpic1:103-gnu-unix-commands
  • lpic1:108-essential-services
  • lfcs:essential-commands
  • lfcs:operations-deployment
  • lfcs:services-logs
  • linuxplus:provisional
  • linuxplus:services-users
  • linuxplus:troubleshooting
  • risk:read-only

Useful for

  • LPIC-1 style command-line practice
  • LFCS style performance tasks
  • Linux+ style troubleshooting review

Independent study support only. No affiliation, endorsement, exam dumps, or real exam questions.