Custom Search

Wednesday, May 14, 2008

The Process Status command: ps

ps command is used to display the process attributes. The command reads through the kernel's data structures and process tables to fetch the characterstics of processes. e.g. if you execute the command immediately after logging in you will see the following:

$ ps
PID TTY TIME CMD
291 console 0:00 bash

Inorder to get a detailed listing showing the parent of every process you can use the -f (full) option:

$ ps -f
UID PID PPID C STIME TTY TIME CMD
sam 257 191 0 10:25:12 console 0:00 vi create_user.sh
sam 191 1 0 08:22:23 console 0:00 -bash
sam 268 267 0 10:25:16 console 0:00 /user/bin/bash -i

As you can see the parent (PPID) and the owner (UID) of every process. The login shell (PID 191) has the PPID 1, the second process of the system. The first process is always init having PID 0.

No comments: