Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I see what processes are running on a remote ubuntu server and kill them? [closed]

Tags:

ssh

nohup

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.

like image 825
fancy Avatar asked Jan 11 '12 22:01

fancy


People also ask

How do I end all processes in Ubuntu?

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.

How do I find out what processes are running in the background Linux?

You can list running processes using the ps command (ps means process status). The ps command displays your currently running processes in real-time.


2 Answers

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.

like image 77
TheOx Avatar answered Oct 08 '22 22:10

TheOx


No need for any pipes with pgrep:

pgrep -l httpd
like image 38
sluque Avatar answered Oct 08 '22 23:10

sluque