🐧 journalctl Command Guide (Linux Logs Made Easy)

🐧 journalctl Command Guide (Linux Logs Made Easy)
🧱 Device
Operating System(s)

journalctl is used to view logs collected by systemd’s journal service. It replaces traditional log files and gives you powerful filtering for debugging issues.

▶️ Basic Usage

View all logs

 

journalctl

 

Follow logs in real-time (like tail -f)

 

journalctl -f

 

⏱️ Filter Logs by Time

Show logs from today

 

journalctl --since today

 

Show logs from the last hour

 

journalctl --since "1 hour ago"

 

Custom time range

 

journalctl --since "2026-05-04 10:00:00" --until "2026-05-04 12:00:00"

 

🔧 Filter by Service

View logs for a specific service

 

journalctl -u nginx

 

Follow logs for a service

 

journalctl -u apache2 -f

 

✔ Essential for debugging services like web servers or drivers

⚠️ View Errors Only

 

journalctl -p err

 

Other levels:

  • 0 = emergency
  • 3 = error
  • 4 = warning
  • 6 = info

🖥️ View Logs from Current Boot

 

journalctl -b

 

Previous boot

 

journalctl -b -1

 

✔ Useful after crashes or failed startups

📂 Kernel Logs Only

 

journalctl -k

 

✔ Similar to dmesg, but more detailed

👤 Filter by User

 

journalctl _UID=1000

 

📄 Output Options

Show latest 50 lines

 

journalctl -n 50

 

Disable pager (no scrolling)

 

journalctl --no-pager

 

Export logs to file

 

journalctl > logs.txt

 

🔐 Disk Usage & Cleanup

Check journal size

 

journalctl --disk-usage

 

Clear old logs (keep last 7 days)

 

sudo journalctl --vacuum-time=7d

 

⚠️ Common Issues

No logs showing?

Run as root:

 

sudo journalctl

 

Logs disappear after reboot?

Persistent logging may not be enabled. Check:

 

sudo mkdir -p /var/log/journal
sudo systemctl restart systemd-journald

 

🧠 When to Use journalctl

  • System crashes or boot failures
  • Service errors (Apache, Nginx, Docker, etc.)
  • Hardware or driver issues
  • Kernel debugging

💡 Pro Tip

Use this combo for fast troubleshooting:

 

journalctl -xe

 

✔ Shows recent errors with explanations
✔ Great starting point when something breaks

Linux Commands

Files

tar · pv · cat · tac · chmod · grep ·  diff · sed · ar · man · pushd · popd · fsck · testdisk · seq · fd · pandoc · cd · $PATH · awk · join · jq · fold · uniq · journalctl · tail · stat · ls · fstab · echo · less · chgrp · chown · rev · look · strings · type · rename · zip · unzip · mount · umount · install · fdisk · mkfs · rm · rmdir · rsync · df · gpg · vi · nano · mkdir · du · ln · patch · convert · rclone · shred · srm · scp · gzip · chattr · cut · find · umask · wc · tr · hash  · compgen

Processes

alias · screen · top · nice · renice · progress · strace · systemd · tmux · chsh · history · at · batch · free · which · dmesg · chfn · usermod · ps · chroot · xargs · tty · pinky · lsof · vmstat · timeout · wall · yes · kill · sleep · sudo · su · time · groupadd · usermod · groups · lshw · shutdown · reboot · halt · poweroff · passwd · lscpu · crontab · date · bg · fg · pidof · nohup · pmap

Networking

netstat · ping · traceroute · ip · ss · whois · fail2ban · bmon · dig · finger · nmap · ftp · curl · wget · who · whoami · w · iptables · ssh-keygen · ufw · arping · firewalld