Five progressive exercises taking you from basic grep searches through real security log analysis, I/O redirection, and multi-stage pipeline construction. These are production-level skills.
grep -i "root" /etc/passwd — how many lines match?grep -c "bash" /etc/passwd — how many users use bash?grep -n "PermitRootLogin" /etc/ssh/sshd_configgrep -v "^#" /etc/ssh/sshd_config | grep -v "^$"grep -r "PasswordAuthentication" /etc/ssh/ 2>/dev/nullgrep -A 2 -B 1 "Port" /etc/ssh/sshd_configgrep -E "root|admin|sudo" /etc/passwdgrep -oE "[0-9]+" /etc/passwd | sort -rn | head -5date > ~/timestamp.txt && cat ~/timestamp.txtdate >> ~/timestamp.txt && date >> ~/timestamp.txt && cat ~/timestamp.txt — should have 3 lines nowls /nonexistent 2>/dev/null — verify no error is printedls /etc /nonexistent > ~/output.txt 2>&1 && cat ~/output.txtsort < ~/timestamp.txtls -la /etc | tee ~/etc-listing.txt | wc -lcat /etc/passwd | grep -v "^#" | wc -l > ~/usercount.txt && cat ~/usercount.txtcat /etc/passwd | cut -d: -f7 | sort | uniqcat /etc/passwd | cut -d: -f7 | sort | uniq -c | sort -rnls -la /usr/bin | awk '{print $5, $9}' | sort -rn | head -10ps aux | awk '{print $8}' | sort | uniq -c | sort -rnss -tlnp 2>/dev/null | grep LISTEN | awk '{print $4}' | sortcat /etc/hosts | wc -wps aux | awk '{print $1}' | tail -n +2 | sort | uniq -c | sort -rn | head -5awk -F: '{print $1, $3}' /etc/passwd | column -tawk -F: '$3 < 1000 {print $1, $3}' /etc/passwdawk -F: '$3 >= 1000 && $3 < 65534 {print $1, $3, $6}' /etc/passwddf -h | awk 'NR>1 {print $1, $2}'awk -F: '{printf "User: %-20s Shell: %s\n", $1, $7}' /etc/passwd | head -10awk 'END {print NR, "lines"}' /etc/passwdls -la /var/log/auth.log 2>/dev/null || echo "auth.log not found"sudo bash -c 'for i in 1 2 3 4 5; do echo "$(date) sshd[$$]: Failed password for invalid user admin from 192.168.1.$((RANDOM % 255)) port $((RANDOM % 60000 + 1024)) ssh2" >> /var/log/auth.log.practice; done'grep "Failed password" /var/log/auth.log 2>/dev/null | head -20grep "Failed password" /var/log/auth.log 2>/dev/null | grep -oE "([0-9]+\.){3}[0-9]+" | sort | uniq -c | sort -rn | head -10grep "Accepted" /var/log/auth.log 2>/dev/nullgrep -i "failed.*root\|root.*failed" /var/log/auth.log 2>/dev/null | wc -lgrep "Failed password" /var/log/auth.log 2>/dev/null | grep -oE "([0-9]+\.){3}[0-9]+" | sort | uniq -c | sort -rn > ~/ssh-attack-report.txt && echo "Report saved" && cat ~/ssh-attack-report.txt