Interview Prep/Shell Scripting/Best practices and rapid-fire commands

Rapid fire: one-liners for logs and text.

BeginnerConceptBest practices and rapid-fire commands
Answer
journalctl -u nginx --since '1 hour ago' -p err --no-pager
tail -F /var/log/app/app.log | grep --line-buffered ERROR
grep -c ' 500 ' access.log
awk '{print $9}' access.log | sort | uniq -c | sort -rn
sed -n '100,120p' app.log
grep -rIl 'TODO' --exclude-dir=.git .
awk 'length > 500' app.log | head                   # suspiciously long lines
zcat app.log.*.gz | grep -F 'timeout' | wc -l

--line-buffered makes grep flush each line, so piping tail -F into it works in real time.

All Shell Scripting questions Roadmap: Shell scripting (Bash)

More on Best practices and rapid-fire commands