My (previous) NAS needed some TLC. Made extensive use of the following commands to get rid of unnecessary services.
Future me will thank me for documenting.
nmap
# scan all ports on localhost
nmap -Pn -p- localhost
# probe scan specific port
nmap -Pn -sV -p3456 localhostapt
apt list --installed | grep pkg
sudo apt purge *pkg*
sudo apt autoremovelsof
sudo lsof -i TCP:3456ps aux
ps aux | grep <PID>find
sudo find / -name *.log -a -name *cron*
# I could have just written this as the following...
# but I wanted to test the -a flag
sudo find / -name *cron*.logmisc
pkill
locateEOF