Beginner · 7 missions
Reading & searching text — Linux terminal practice
Read big files the smart way: head, tail, wc and grep on a real-looking server log.
Missions in this track
Badi files aur logs ko head, tail, wc aur grep se padhna seekho.
-
1
First lines
Show the first 5 lines of
/var/log/auth.log.Show the command
head -n 5 /var/log/auth.logauth.logrecords every login attempt on a Linux server. -
2
Last lines
Show the last 3 lines of the same log.
Show the command
tail -n 3 /var/log/auth.logtail -f filekeeps following a log live — used daily by SOC analysts. -
3
Count lines
Count how many lines the log has.
Show the command
wc -l /var/log/auth.logwc -lcounts lines,-wwords,-cbytes. -
4
Search
Show only the lines that contain Failed password.
Show the command
grep "Failed password" /var/log/auth.loggrep is the most used command in log analysis.
-
5
How many?
Count the failed password lines, then
submitthe number.Show the command
grep -c "Failed password" /var/log/auth.logMany failed logins in a short time = a brute-force attack.
-
6
Ignore case
Search for invalid user ignoring upper/lower case, with line numbers.
Show the command
grep -in "invalid user" /var/log/auth.log"Invalid user" means someone guessed a username that does not even exist.
-
7
Check a setting
In
/etc/ssh/sshd_config, find the PermitRootLogin setting andsubmitits value.Show the command
grep PermitRootLogin /etc/ssh/sshd_configPermitRootLogin yes is a classic weakness — attackers can brute-force root directly.