System information

22 System Analysis and Tuning Guide
0x00000000 83984391 tux 666 282464 2
0x00000000 84738056 root 644 151552 2 dest
------ Semaphore Arrays --------
key semid owner perms nsems
0x4d038abf 0 tux 600 8
------ Message Queues --------
key msqid owner perms used-bytes messages
2.3.2 Process List: ps
The command ps produces a list of processes. Most parameters must be written with-
out a minus sign. Refer to ps --help for a brief help or to the man page for exten-
sive help.
To list all processes with user and command line information, use ps axu:
tux@mercury:~> ps axu
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 696 272 ? S 12:59 0:01 init [5]
root 2 0.0 0.0 0 0 ? SN 12:59 0:00 [ksoftirqd
root 3 0.0 0.0 0 0 ? S< 12:59 0:00 [events
[...]
tux 4047 0.0 6.0 158548 31400 ? Ssl 13:02 0:06 mono-best
tux 4057 0.0 0.7 9036 3684 ? Sl 13:02 0:00 /opt/gnome
tux 4067 0.0 0.1 2204 636 ? S 13:02 0:00 /opt/gnome
tux 4072 0.0 1.0 15996 5160 ? Ss 13:02 0:00 gnome-scre
tux 4114 0.0 3.7 130988 19172 ? SLl 13:06 0:04 sound-juic
tux 4818 0.0 0.3 4192 1812 pts/0 Ss 15:59 0:00 -bash
tux 4959 0.0 0.1 2324 816 pts/0 R+ 16:17 0:00 ps axu
To check how many sshd processes are running, use the option -p together with the
command pidof, which lists the process IDs of the given processes.
tux@mercury:~> ps -p $(pidof sshd)
PID TTY STAT TIME COMMAND
3524 ? Ss 0:00 /usr/sbin/sshd -o PidFile=/var/run/sshd.init.pid
4813 ? Ss 0:00 sshd: tux [priv]
4817 ? R 0:00 sshd: tux@pts/0
The process list can be formatted according to your needs. The option -L returns a
list of all keywords. Enter the following command to issue a list of all processes sorted
by memory usage:
tux@mercury:~> ps ax --format pid,rss,cmd --sort rss
PID RSS CMD
2 0 [ksoftirqd/0]