Linux Survival Basics
Read-only, can be slowRead 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.
$ 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
journalctl -u nginx -b --no-pager -n 80journalctl --disk-usage
next steps
Related commands
Inspect One Service Without Pager Traps
Make systemctl status safe for scripts, screenshots, and quick incident notes.
systemctl status nginx --no-pager --lines=30
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'
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
Read the Failure Cause in systemctl Status
The status page often tells you the failed startup step before you open every log.
systemctl status app-worker --no-pager --lines=50
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.
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.