8

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.

fancy
  • 48,619
  • 62
  • 153
  • 231

2 Answers2

18

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.

TheOx
  • 2,208
  • 25
  • 28
4

No need for any pipes with pgrep:

pgrep -l httpd
andrewsi
  • 10,807
  • 132
  • 35
  • 51
sluque
  • 495
  • 4
  • 12