Monitoring Programspeeking at the processes
When a program runs on the system, it's referred to as a process. To examine these processes, your need to become familiar with the PS command, the Swiss Army knife of utilities. It can produce lots of information about all the programs running on your system.
The basic ps command doesn ' t really provide all that much information:
$ ps pid TTY time CMD 3081 pts/0 00 : 00 : 00 bash 3209 pts/0 00 : 00 : 00 ps $
Not too exciting. By default, the PS command shows only the processes. Belong to the current user and that is running on the C Urrent terminal. In this case, we had only our bash shell running (remember, the shell was just another program running on the system) and, Of course, the PS command itself. The basic output shows the process ID (PID) of the programs, the terminal (TTY) that they is running from, and the CPU ti Me the process has used.
The GNU PS command that's used in Linux systems supports three different types of command
Line parameters:
unix-style parameters, which is preceded by a dash
bsd-style parameters, which is not preceded by a dash
GNU long Parameters, which is preceded by a double dash
Unix-style Parameters
That's a lot of parameters, and there is still more! The key to using the-the PS command is not-to-memorize all the available parameters-only those your find most useful.
-EF parameter
$PS-efuid PID PPID C stime TTY time Cmdroot1 0 0 One: in?xx:xx: oninit [5]root2 0 0 One: in?xx:xx:xx[Kthreadd]root3 2 0 One: in?xx:xx:xx[migration/0]root4 2 0 One: in?xx:xx:xx[ksoftirqd/0]root5 2 0 One: in?xx:xx:xx[watchdog/0]root6 2 0 One: in?xx:xx:xx[events/0]root7 2 0 One: in?xx:xx:xx[Khelper]root - 2 0 One: in?xx:xx:xx[kblockd/0]root - 2 0 One: in?xx:xx:xx[Kacpid] the 2349 1 0 One: -?xx:xx:xxHaldroot3078 1981 0 A:xx?xx:xx:xxSshd:rich [Priv]rich3080 3078 0 A:xx?xx:xx:xxsshd: [Email protected]/0Rich3081 3080 0 A:xxpts/0 xx:xx:xx-Bashrich4445 3081 3 -: -pts/0 xx:xx:xx PS-ef$
■ UID:The user responsible for launching the process
■ PID:Process ID of the process
PPID:The PID of the parent process (if a process is started by another process)
C: Processor utilization over the lifetime of the process
stime: The system time when the process started
TTY: The terminal device from which, the process was launched
Time : The cumulative CPU time required to run the process
CMD: The name of the program is started
- L parameter
$PS-LF S UID PID PPID C PRI NI ADDR SZ wchan TTY time CMD0S - 3081 3080 0 the 0-1173 waitpts/0 xx:xx:xxBash0R - 4463 3081 1 the 0-1116-pts/0 xx:xx:xx PS$
F: System flags assigned to the process by the kernel
S: The state of the process (O = running on processor; S = sleeping; R = runnable, waiting to run; Z = Zombie, process terminated but the parent not available; T = Process stopped)
PRI: The priority of the process (higher numbers mean lower)
NI: The Nice value (degree of humility), which is used for determining priorities
ADDR: The memory address of the process
SZ: Approximate amount of swap space required if the process is swapped out
Wchan: Address of the kernel function where the process is sleeping
4th more bash shell commands