Troubleshooting Server Issues with systemctl, netstat


Sun Apr 18 2021 03:10:25 GMT+0000 (UTC)

Saved by @FlorianC #linux #server #services #cloud

# check the status of the web server i.e apache2
sudo systemctl status apache2

# restart the service
sudo systemctl restart apache2

# return network-related information using a combination of flags along with the netstat command to check which process is using a particular port
sudo netstat -nlp

# find python3 programs running
ps -ax | grep python3

# kill a process by its process ID (PID)
sudo kill [process-id]

# let's check for the availability of any service with the keywords "python" or "jimmy"
sudo systemctl --type=service | grep jimmy

# stop and disable a service using
sudo systemctl stop _servicename_ && sudo systemctl disable _servicename_