Friday, May 27, 2011

process, kill

A process is a program in execution. It has several properties including priority. In Linux a process is identified by its PID (Process ID).

To view the information about active process we use 'ps'. This command gives status and properties of process.

syntax

ps [options]

 -e              Select all processes

 -u             Selects the processes whose user name or ID is in userlist.

 -o            user-defined format.

Eg: ps -eo pid,comm,%cpu

Output:

.
....
1516 evolution-excha  0.0
1557 notify-osd       0.0
1573 update-notifier  0.0
1611 firefox-bin     17.2
1671 plugin-containe  2.2
1935 gnome-terminal   1.2
.............
.......
..

ps -eo pid,s,user

Here 's' gives process state codes

D    Uninterruptible sleep (usually IO)
R    Running or runnable (on run queue)
S    Interruptible sleep (waiting for an event to complete)
T    Stopped, either by a job control signal or because it is being traced.
W    paging (not valid since the 2.6.xx kernel)
X    dead (should never be seen)
Z    Defunct ("zombie") process, terminated but not reaped by its parent.
Kill

'kill' command sends a signal to processes, causing them to
terminate.

kill PID

Eg: kill 2016

This command will terminate the process whose PID is 2016

Eg:kill 9 2016

This will forcefully terminate the process whose PID is 2016

No comments:

Post a Comment

Powered By Blogger

Followers