Awk: Difference between revisions
No edit summary |
No edit summary |
||
| Line 5: | Line 5: | ||
; see who's trying to SSH into your server (brute force attack) | ; see who's trying to SSH into your server (brute force attack) | ||
awk '/Invalid user/ {print $8}' /var/log/auth.log | sort | uniq -c | awk '/Invalid user/ {print $8}' /var/log/auth.log | sort | uniq -c | ||
Tricky use of Output Record Separator (ORS) to use '''space''' instead of newline between records. Oddly enough, you don't need to escape the double quote within the double quote because the awk command is in single quotes. | |||
; print a apt purge command for all the 'removed' 'configured' packages on your system | |||
echo "apt purge $(dpkg -l | egrep '^rc' | awk 'ORS=" " {print $2}')" | |||
== Docs == | == Docs == | ||