1843974 Members
2103 Online
110226 Solutions
New Discussion

how kill user process?

 
Sandeep Daphal
Frequent Advisor

how kill user process?

I am root user& i wan kill user process form the system. how to check & kill taht processor.

pls help me.

Sandeep Daphal
4 REPLIES 4
Alex Jenner
Advisor

Re: how kill user process?

Let me see if I understand you correctly - you have a user, for example user 'jsmith' who is running a process called 'foo' and you want to kill that process?

So you need to login as root and use:

# ps -ef | grep jsmith
jsmith 1234 1231 1 18:20 pts/1 0:20 foo

Or you could use:

# ps -ef | grep foo
jsmith 1234 1131 1 18:20 pts/1 0:20 foo

In either case, ps tells you the process id to kill is '1234' (not '1131' - that is the parent process id), so to kill the 'foo' process use:

# kill 1234

Or you might need 'kill -9' or one of the other options ('man kill' for details).
Murat SULUHAN
Honored Contributor

Re: how kill user process?

Hi

kill `ps -ef | grep | awk '{print $2}'`

Best Regards
Murat
HP
Murat Suluhan
Srimalik
Valued Contributor

Re: how kill user process?

ps -ef will list all the processes running on a system.

The first field(string) of each line of output is the user who is the owner of the process , the second field(number) is the PID of the process and the third field(number) is the PID of the parent of that process.

You can kill a process by using the kill command

kill -SIGNUM PID(second field)

You can use one of many signals avalable. But avoid using SIGKILL(9) , because it forcefully kill a process. you can use SIGTERM for a a graceful exit if the process has done some handling for SIGTERM.

e.g.
kill -TERM 3245


abandon all hope, ye who enter here..
Sandeep Daphal
Frequent Advisor

Re: how kill user process?

Thanks for help