I started some processes with nohup and they aren't working correctly so I need to find and kill them but I dont know the pid or anything.
Killall command allows you to terminate all the processes owned by a specific user. To do this, use the -u flag. For example, to terminate all processes spawned by the ubuntu user.
You can list running processes using the ps command (ps means process status). The ps command displays your currently running processes in real-time.
SSH in and then use the ps command to list running processes in conjunction with the grep command to filter that result list down to what you need:
ps aux | grep something
"ps aux" returns a list of all processes currently running "grep something" takes that list (via the pipe ("|")) and just outputs strings that match "something".
So for example if you wanted to find the httpd process you could use
ps aux | grep httpd
The results will contain the PID you can use to kill them.
No need for any pipes with pgrep:
pgrep -l httpd
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With