ps
ps displays all the processes in a unix system. every command, script or an application is considered as a process in unix. All the processes run until the command or application is completed or stopped. Each process has a unique process id ( PID)
It has the same output of windows tasklist command.
Example 1)
to list only your processes (i:e all the commands , and applications run in current session )
/home/priya$ ps
PID TTY TIME CMD
217140 pts/2 0:00 -ksh
594062 pts/2 0:00 -ksh
652138 pts/2 2:03 java webfile.java
820120 pts/2 0:00 ps
Example 2)
To list all the processes running in the server page wise , use –ef option
/home/priya$ ps -ef | pg
UID PID PPID C STIME TTY TIME CMD
priya 184434 1 24 05:32:34 - 0:50 java /usr/bin/java/start-web.java
root 213146 1 0 05:32:31 - 1:21 java /usr/bin/dsmc
matt 327814 893836 0 12:28:09 - 0:00 sleep 120
root 352266 1 0 05:32:38 - 0:14 java /usr/bin/ftpd
priya 368734 1 0 05:32:42 - 0:07
priya 372912 1 0 05:32:43 - 0:10 java /usr/bin/java/start-web3.java
scripts 409806 1 0 05:32:39 - 0:13 java /usr/bin/java/start-web2.java -d final -f clear
scripts 418030 1 0 05:32:35 - 1:08 java /usr/bin/java/start-web.java -d final -f clear
scripts 430084 1 0 05:32:23 - 0:02 /usr/bin/perl -w getfile.cgi
scripts 442592 430084 0 12:17:38 - 0:00 sleep 900
scripts 454810 1 3 05:32:29 - 1:42 java /usr/bin/java/start-web.java -d final -f clear
standard input
Example 3)
To list all the processes which are run by an user,
To list all the processes which are run by an user,
/home/priya$ ps -fu matt
UID PID PPID C STIME TTY TIME CMD
matt 174431 1 24 05:32:34 - 0:50 wc -l
matt 723156 1 0 05:32:31 pts/2 1:21 cat items
matt 327814 893836 0 12:28:09 - 0:00 sleep 120
matt 1566 1 0 0 5:32:38 pts/1 0:14 sed ‘s/sim//’
matt 668739 1 0 05:32:42 - 0:07 /usr/bin/perl
matt 352912 1 0 05:32:43 - 0:10 java hello.java
All your processes and the processes of other users can be viewed.
In the output of the command above ,the various column heads are defined as follows.
PID
The process ID of the process.
UID
The user ID of the process owner. The login name is printed under the -f flag.
PPID
The process ID of the parent process.
C
CPU utilization of process or thread, incremented each time the system clock ticks and the process or thread is found to be running. Large values indicate a CPU intensive process and result in lower process priority whereas small values indicate an I/O intensive process and result in a more favourable priority.
STIME
The starting time of the process.
TTY
The controlling terminal for the process
if There is a ‘-‘ ,it means the process is not associated with a terminal.
Otherwise indicates The TTY number. For example, the entry pts/2 indicates terminal 2.
CMD
Contains the command name which started the process. The full command name and its parameters are displayed with the -f flag.
Thank you for sharing this blog. This blog will help to improve my knowledge.
ReplyDeleteUnix course in Chennai | Unix Training institutes in Chennai | Unix certification in Chennai | Best Unix Training in Chennai