gsmaclean.com

Linux Sysadmin Quick Tips

I’ve been doing a lot more with our Linux machines recently – specifically migrating from old CentOS 7 installs to Ubuntu LTS. While I really love CLI work, sometimes the density and organization of info on the screen leaves something to be desired.

Show apt packages on separate lines

sudo apt upgrade -V

Quick scan of network via nmap for alive hosts

with optional parsing of alive hosts with rdns name.
You can scan a set ‘top port’ list using –top-ports 100 (or whatever number)
You can improve grepability via -oG (grepable output)

nmap -sn -vvv <net addr> ### [| grep 'scan report']
nmap -sT -vvv [-p 22,443] <net addr> ### TCP scan of specified ports
nmap -sU -vvv [-p 161,123] <net addr> ### UDP scan of specified ports

UFW Firewall actions

sudo ufw status numbered ### shows numbered entries so you can edit
sudo ufw allow 443/tcp ### allows any any to 443/tcp
sudo ufw allow from TARGET to DESTINATION port PORTNUMBER [proto PROTOCOL]
sudo ufw delete <rule #>
sudo ufw reload ### reloads the ruleset into active config