Site icon New Generation Enterprise Linux

Tame Your `journalctl` Output with Time Filtering

Quick Tip

Tame Your `journalctl` Output with Time Filtering

Challenge: You need to quickly find log entries from a specific timeframe on your RHEL or Ubuntu system, but scrolling through endless logs is time-consuming and inefficient.

The Solution: Utilize `journalctl`’s powerful time-based filtering options to pinpoint relevant log messages.

journalctl --since "2 hours ago" --until "now" -u sshd.service

Why it works: The `–since` and `–until` flags allow you to specify a time range (e.g., “2 hours ago”, “yesterday”, “2023-10-27 10:00:00”). Combining this with the `-u` flag to filter by service makes it incredibly efficient for troubleshooting.

Pro-Tip: Use relative times like “10m” for 10 minutes ago, “3h” for 3 hours ago, or even “yesterday” for quick filtering.

Linux Tips & Tricks | © ngelinux.com | 4/28/2026

0 0 votes
Article Rating
Exit mobile version