Search GimmeJob

Type at least 2 characters. Enter also searches by meaning.
QA interview question
InfrastructureJuniorOccasionalTroubleshooting

Which Linux commands are useful for reading a large log file and watching new lines appear?

Answer

Use `less` for interactive reading without loading the entire file into an editor, `head` or `tail` for a limited number of lines, and `tail -f` to follow appended lines. For systemd-managed services, `journalctl -u <service>` is often more appropriate than assuming the service writes a plain text file.

Strong answer includes

  • less for interactive large-file inspection
  • tail -f follows appended lines
  • journalctl is relevant for systemd service logs

Practical example

While reproducing an API failure on a Linux host, run `tail -f /var/log/app/app.log` in one terminal and the test in another. If the app is managed by systemd, use `journalctl -u app.service -f` instead.

#linux#logs#tail#journalctl

Sources

GNU Coreutils manualGNU Project · Linux and Unix-like filesystem, text, disk-usage and shell utility behaviorsystemd manualsystemd project · systemctl, journalctl, service units and systemd operational behavior50 Linux Interview Questions (With Answers)Toolmingo · Recurrence signal for Linux filesystem, permissions, processes, systemd, networking and shell-command interview topics