Ravindra BagaleCourses & study guides मराठी Track your progress

Ravi Sir's Cyber Security Cards › Revision Cards

Viewing Files and Following Logs

Viewing Files and Following Logs Commands to read files: cat (whole file), less (page by page), tail (last lines). tail -f shows new log lines live as they arrive. sudo tail -f /var/log/auth.log (Ubuntu) shows login attacks live, just as a SOC analyst sees them. On Amazon Linux 2023: sudo journalctl

Viewing Files and Following Logs Commands to read files: cat (whole file), less (page by page), tail (last lines). tail -f shows new log lines live as they arrive. sudo tail -f /var/log/auth.log (Ubuntu) shows login attacks live, just as a SOC analyst sees them. On Amazon Linux 2023: sudo journalctl
Viewing Files and Following Logs · Download PNG
Read card text

What this card says

What it is

Commands to read files: cat (whole file), less (page by page), tail (last lines).

Following logs

tail -f shows new log lines live as they arrive.

Why it matters for security

sudo tail -f /var/log/auth.log (Ubuntu) shows login attacks live, just as a SOC analyst sees them.

On Amazon Linux 2023: sudo journalctl -u sshd -f.

Common mistake

Using cat on a huge log fills the screen.

Use less or tail -n 50 for big files.

CommandUse
cat filePrint entire file
less fileScroll page by page (Space next, b back, /word search, q…
more fileOlder, simpler pager
head -n 20 fileFirst 20 lines
tail -n 20 fileLast 20 lines

Learn more in the lesson: 5.4 Viewing Files and Following Logs

See all Ravi Sir's Cyber Security Cards