Skip to main content

Check if port is in use

🗎 Refs: Check port in use on Linux
# Ubuntu
sudo lsof -i -P -n | grep LISTEN
sudo lsof -i:$PORT
sudo ss -tulpn | grep LISTEN
sudo nmap -sTU -O $IP_ADDRESS

# AlmaLinux
sudo firewall-cmd --list-ports

Check local IP

ip -4 addr show | grep inet

Check systemctl services

# Specified service
sudo systemctl status $SERVICE_NAME
# All running services:
sudo systemctl --type=service

Check disk usage

echo "Free disk space:" && \
df -h ~ | awk 'NR==2 {print $4 " available on " $6}' && \
echo -e "\nTop 5 largest directories in $HOME:" && \
du -h --max-depth=1 ~ | sort -hr | head -n 5