Linux commands useful to know.
Display CPU information: $ inxi -Fi
Display server connections: $ netstat -pnt
Display public ip address: $ host myip.opendns.com resolver1.opendns.com
Display DNS servers: $ resolvectl status
Flush DNS cache: $ sudo resolvectl flush-caches
Display DNS cache statistics: $ sudo resolvectl statistics
Display and search for running processes: $ ps aux | less
Display process id of a service: $ pidof ssh
Disable apache2 server running at startup: $ systemctl stop apache2 then $ sudo systemctl disable apache2
Change clock timezone to local time: $ timedatectl set-local-rtc 1 --adjust-system-clock
Display Linux firewall status: $ sudo ufw status numbered
Delete Linux firewall rule: $ sudo ufw delete [number]
Delete multiple Linux firewall rules: $ sudo ufw status numbered then $ for i in 10 9 8 7 6; do sudo ufw delete $i;done
Block ip address in Linux firewall: $ sudo ufw insert 1 deny from 100.20.30.40/32 comment "Block 100.20.30.40 SSH attempt"
Display size of journal logs: $ journalctl --disk-usage
Reducue size of journal logs: $ sudo journalctl --vacuum-time=2weeks or $ sudo journalctl --vacuum-size=100M
Display SSH logs: $ sudo journalctl -fu ssh or $ sudo journalctl -u ssh --since "3 days ago"
Create a SOCKS proxy with SSH: $ ssh -D [portnumber] -q -f -T -N -C user@ipaddress -p [portnumber]
Display services running on systemd: $ systemctl list-unit-files
Display disabled services on systemd: $ systemctl list-unit-files --type=service --state=disabled
Display status of service on systemd: $ sudo systemctl status [nameofservice]
Empty/Overwrite a file without destroying the file: $ printf "" > somefile.txt or $ sudo cp /dev/null somefile.txt
Confirm if system boots via BIOS or UEFI: $ ls /sys/firmware/efi or $ dmesg | grep "EFI v"
Check if a port is open or closed using netcat: $ netcat -w1 -z -v [HOST] [PORT] e.g. $ netcat -w1 -z -v example.com 443
A great resource for Linux administration by Elliot Cooper, can be found at bash-prompt.net.