Ps stands for process status. This command is used to display the process status. It provides the currently running process status information. In Linux, every process will be assigned a number known as the process id (PID ).
Four items are labeled with this command output
- PID: Process identification
- TTY: Terminal type is the name of the console or the terminal which the user is logged in. this information helps the administrator when
- TIME: Gives the amount of time in minutes and seconds that the process has been running.
- CMD: The name of the command that initiated the process.
mint @mint ~ $ ps
PID TTY TIME CMD
3350 pts/0 00:00:00 bash
3370 pts/0 00:00:00 ps
mint @mint ~ $
PID TTY TIME CMD
3350 pts/0 00:00:00 bash
3370 pts/0 00:00:00 ps
mint @mint ~ $
Options
-a: All processes status
mint @mint ~ $ ps -a
PID TTY TIME CMD
2660 tty4 00:00:02 bash
2661 tty6 00:00:02 bash
2662 tty2 00:00:01 bash
2663 tty3 00:00:02 bash
2664 tty5 00:00:02 bash
2861 tty1 00:00:01 bash
3862 pts/0 00:00:00 ps
mint @mint ~ $
PID TTY TIME CMD
2660 tty4 00:00:02 bash
2661 tty6 00:00:02 bash
2662 tty2 00:00:01 bash
2663 tty3 00:00:02 bash
2664 tty5 00:00:02 bash
2861 tty1 00:00:01 bash
3862 pts/0 00:00:00 ps
mint @mint ~ $
-e : Every user process status in the network
$ps –e
mint @mint ~ $ ps -e
PID TTY TIME CMD
1 ? 00:00:01 init
2 ? 00:00:00 kthreadd
3 ? 00:00:00 ksoftirqd/0
4 ? 00:00:01 migration/0
5 ? 00:00:00 watchdog/0
6 ? 00:00:01 migration/1
7 ? 00:00:00 ksoft1rqd/1
8 ? 00:00:00 watchdog/1
9 ? 00:00:01 migration/2
10 ? 00:00:00 ksoft1r0/2
11 ? 00:00:00 watchdog/2
12 ? 00:00:00 migration/3
13 ? 00:00:00 ksOft1r0/3
14 ? 00:00:00 watchdog/3
15 ? 00:00:00 events/0
16 ? 00:00:00 events/1
17 ? 00:00:00 events/2
18 ? 00:00:00 events/3
19 ? 00:00:00 cpuset
20 ? 00:00:00 khelper
21 ? 00:00:00 netAS
22 ? 00:00:00 async/mgr
23 ? 00:00:00 pm
25 ? 00:00:00 sync_supers
26 ? 00:00:00 bd1.default
27 ? 00:00:00 lantegrityd/0
PID TTY TIME CMD
1 ? 00:00:01 init
2 ? 00:00:00 kthreadd
3 ? 00:00:00 ksoftirqd/0
4 ? 00:00:01 migration/0
5 ? 00:00:00 watchdog/0
6 ? 00:00:01 migration/1
7 ? 00:00:00 ksoft1rqd/1
8 ? 00:00:00 watchdog/1
9 ? 00:00:01 migration/2
10 ? 00:00:00 ksoft1r0/2
11 ? 00:00:00 watchdog/2
12 ? 00:00:00 migration/3
13 ? 00:00:00 ksOft1r0/3
14 ? 00:00:00 watchdog/3
15 ? 00:00:00 events/0
16 ? 00:00:00 events/1
17 ? 00:00:00 events/2
18 ? 00:00:00 events/3
19 ? 00:00:00 cpuset
20 ? 00:00:00 khelper
21 ? 00:00:00 netAS
22 ? 00:00:00 async/mgr
23 ? 00:00:00 pm
25 ? 00:00:00 sync_supers
26 ? 00:00:00 bd1.default
27 ? 00:00:00 lantegrityd/0
$ps –ef
$ps –eF
$-ely
$ps –eF
$-ely
mint @mint ~ $ ps -ef
UID PID PPID C STIME TTY TIME CMD
root 1 0 0 22:45 ? 00:00:01 /00
root 2 0 0 22:45 ? 00:00:00 [kthreadd]
root 3 2 0 22:45 ? 00:00:00 [ksoftirqd/01]
root 4 2 0 22:45 ? 00:00:01 [migration/0]
root 5 2 0 22:45 ? 00:00:00 [watchdog/01]
root 6 2 0 22:45 ? 00:00:01 [migration/1]
root 7 2 0 22:45 ? 00:00:00 [ksoftirqd/I]
root 8 2 0 22:45 ? 00:00:00 [watchdog/11]
root 9 2 0 22:45 ? 00:00:01 [migration/2]
root 10 2 0 22:45 ? 00:00:00 [ksoftirc0/2]
root 11 2 0 22:45 ? 00:00:00 [watchdog/4]
root 12 2 0 22:45 ? 00:00:00 [migration/3]
root 13 2 0 22:45 ? 00:00:00 [ksoftirqd/3]
root 14 2 0 22:45 ? 00:00:00 [watchdog/3]
root 15 2 0 22:45 ? 00:00:00 [events/0]
root 16 2 0 22:45 ? 00:00:00 [events/1]
root 17 2 0 22:45 ? 00:00:00 [events/2]
root 18 2 0 22:45 ? 00:00:00 [events/3]
root 19 2 0 22:45 ? 00:00:00 [cpuset]
root 20 2 0 22:45 ? 00:00:00 [khelperi]
root 21 2 0 22:45 ? 00:00:00 [netns]
root 22 2 0 22:45 ? 00:00:00 [async/sgr]
root 23 2 0 22:45 ? 00:00:00 [pm]
root 25 2 0 22:45 ? 00:00:00 [sync supers]
root 26 2 0 22:45 ? 00:00:00 [WM-default]
root 27 2 0 22:45 ? 00:00:00 [k1ntegrItyd/0]
root 28 2 0 22:45 ? 00:00:00 [kintegrity0/]
UID PID PPID C STIME TTY TIME CMD
root 1 0 0 22:45 ? 00:00:01 /00
root 2 0 0 22:45 ? 00:00:00 [kthreadd]
root 3 2 0 22:45 ? 00:00:00 [ksoftirqd/01]
root 4 2 0 22:45 ? 00:00:01 [migration/0]
root 5 2 0 22:45 ? 00:00:00 [watchdog/01]
root 6 2 0 22:45 ? 00:00:01 [migration/1]
root 7 2 0 22:45 ? 00:00:00 [ksoftirqd/I]
root 8 2 0 22:45 ? 00:00:00 [watchdog/11]
root 9 2 0 22:45 ? 00:00:01 [migration/2]
root 10 2 0 22:45 ? 00:00:00 [ksoftirc0/2]
root 11 2 0 22:45 ? 00:00:00 [watchdog/4]
root 12 2 0 22:45 ? 00:00:00 [migration/3]
root 13 2 0 22:45 ? 00:00:00 [ksoftirqd/3]
root 14 2 0 22:45 ? 00:00:00 [watchdog/3]
root 15 2 0 22:45 ? 00:00:00 [events/0]
root 16 2 0 22:45 ? 00:00:00 [events/1]
root 17 2 0 22:45 ? 00:00:00 [events/2]
root 18 2 0 22:45 ? 00:00:00 [events/3]
root 19 2 0 22:45 ? 00:00:00 [cpuset]
root 20 2 0 22:45 ? 00:00:00 [khelperi]
root 21 2 0 22:45 ? 00:00:00 [netns]
root 22 2 0 22:45 ? 00:00:00 [async/sgr]
root 23 2 0 22:45 ? 00:00:00 [pm]
root 25 2 0 22:45 ? 00:00:00 [sync supers]
root 26 2 0 22:45 ? 00:00:00 [WM-default]
root 27 2 0 22:45 ? 00:00:00 [k1ntegrItyd/0]
root 28 2 0 22:45 ? 00:00:00 [kintegrity0/]
Above commands gives the every process details on the system.
$ ps -ejH
$ psaxjf
mint @mint ~ $ ps -ejm
PID PGID SID TTY TIME CMD
2 0 0 ? 00:00:00 kthreadd
3 0 0 ? 00:00:00 ksoftirqd/0
4 0 0 ? 00:00:01 migration/0
5 0 0 ? 00:00:00 watchdog/0
6 0 0 ? 00:00:01 migration/1
7 0 0 ? 00:00:00 ksoftirqd/1
8 0 0 ? 00:00:00 watchdog/1
9 0 0 ? 00:00:01 migration/2
10 0 0 ? 00:00:00 ksoft1r0/
11 0 0 ? 00:00:00 watchdog/2
12 0 0 ? 00:00:00 migration/3
13 0 0 ? 00:00:00 ksoftirgd/3
14 0 0 ? 00:00:00 watChd051/3
15 0 0 ? 00:00:00 events/0
16 0 0 ? 00:00:00 events/1
17 0 0 ? 00:00:00 eventS/2
18 0 0 ? 00:00:00 events/3
19 0 0 ? 00:00:00 cpuset
20 0 0 ? 00:00:00 khdper
21 0 0 ? 00:00:00 netns
22 0 0 ? 00:00:00 asyncAmpr
23 0 0 ? 00:00:00 pm
25 0 0 ? 00:00:00 sync supers
26 0 0 ? 00:00:00 bd1-defoult
27 0 0 ? 00:00:00 kintegrieyd/0
28 0 0 ? 00:00:00 kintegaty0/1
29 0 0 ? 00:00:00 kintegrity0/2
30 0 0 ? 00:00:00 kIntegrityd/3
PID PGID SID TTY TIME CMD
2 0 0 ? 00:00:00 kthreadd
3 0 0 ? 00:00:00 ksoftirqd/0
4 0 0 ? 00:00:01 migration/0
5 0 0 ? 00:00:00 watchdog/0
6 0 0 ? 00:00:01 migration/1
7 0 0 ? 00:00:00 ksoftirqd/1
8 0 0 ? 00:00:00 watchdog/1
9 0 0 ? 00:00:01 migration/2
10 0 0 ? 00:00:00 ksoft1r0/
11 0 0 ? 00:00:00 watchdog/2
12 0 0 ? 00:00:00 migration/3
13 0 0 ? 00:00:00 ksoftirgd/3
14 0 0 ? 00:00:00 watChd051/3
15 0 0 ? 00:00:00 events/0
16 0 0 ? 00:00:00 events/1
17 0 0 ? 00:00:00 eventS/2
18 0 0 ? 00:00:00 events/3
19 0 0 ? 00:00:00 cpuset
20 0 0 ? 00:00:00 khdper
21 0 0 ? 00:00:00 netns
22 0 0 ? 00:00:00 asyncAmpr
23 0 0 ? 00:00:00 pm
25 0 0 ? 00:00:00 sync supers
26 0 0 ? 00:00:00 bd1-defoult
27 0 0 ? 00:00:00 kintegrieyd/0
28 0 0 ? 00:00:00 kintegaty0/1
29 0 0 ? 00:00:00 kintegrity0/2
30 0 0 ? 00:00:00 kIntegrityd/3
The above command prints the process tree.
$ ps -eLf
$ psaxms
$ psaxms
mint @mint ~ $ ps -ef
UID PID PPID LWP C NLWP STIME TTY TIME CMD
root 1 0 1 0 1 22:45 ? 00:00:01 /00
root 2 0 2 0 1 22:45 ? 00:00:00 [kthreadd]
root 3 2 3 0 1 22:45 ? 00:00:00 [ksoftirqd/0]
root 4 2 4 0 1 22:45 ? 00:00:01 [migration/0]
root 5 2 5 0 1 22:45 ? 00:00:00 [watchdog/0]
root 6 2 6 0 1 22:45 ? 00:00:01 [migration/1]
root 7 2 7 0 1 22:45 ? 00:00:00 [ksoftirqd/I]
root 8 2 8 0 1 22:45 ? 00:00:00 [watchdog/1]
root 9 2 9 0 1 22:45 ? 00:00:01 [migration/2]
root 10 2 10 0 1 22:45 ? 00:00:00 [ksoftirc0/2]
root 11 2 11 0 1 22:45 ? 00:00:00 [watchdog/4]
root 12 2 12 0 1 22:45 ? 00:00:00 [migration/3]
root 13 2 13 0 1 22:45 ? 00:00:00 [ksoftirqd/3]
root 14 2 14 0 1 22:45 ? 00:00:00 [watchdog/3]
root 15 2 15 0 1 22:45 ? 00:00:00 [events/01]
root 16 2 16 0 1 22:45 ? 00:00:00 [events/1]
root 17 2 17 0 1 22:45 ? 00:00:00 [events/2]
root 18 2 18 0 1 22:45 ? 00:00:00 [events/3]
root 19 2 19 0 1 22:45 ? 00:00:00 [cpuset]
root 20 2 20 0 1 22:45 ? 00:00:00 [khelper]
root 21 2 21 0 1 22:45 ? 00:00:00 [netns]
root 22 2 22 0 1 22:45 ? 00:00:00 [async/sgr]
root 23 2 23 0 1 22:45 ? 00:00:00 [pm]
root 25 2 24 0 1 22:45 ? 00:00:00 [sync supers]
root 26 2 25 0 1 22:45 ? 00:00:00 [bdi-default]
root 27 2 26 0 1 22:45 ? 00:00:00 [k1ntegrItyd/0]
root 28 2 27 0 1 22:45 ? 00:00:00 [kintegrity0/]
The above command is to get info about threads.
To see every process running as root (real & effective ID) in user format:
$ ps -U root -u root u
mint@mint ~ S pS -U root -u
warning: bad ps syntax, perhaps a bogus '-' ? See http://Procps.sf.net/faq.html
USER PID %CPU %MEM VSZ RSS TTY STAY START TIME (COMO)
root 1 0.0 0.0 2896 1720 ? Ss 22:45 0:01 /sbin/init
root 2 0.0 0.0 0 0 ? s 22:45 0:00 [kthreadd]
root 3 0.0 0.0 0 0 ? S 22:45 0:00 [ksoftirqd/O]
root 4 0.0 0.0 0 0 ? S 22:45 0:00 [migration/0]
root 5 0.0 0.0 0 0 ? S 22:45 0:00 [watchdog/0]
root 6 0.0 0.0 0 0 ? S 22:45 0:00 [migration/l]
root 7 0.0 0.0 0 0 ? S 22:45 0:00 [kSoftirqd/1]
root 8 0.0 0.0 0 0 ? S 22:45 0:00 [watchdog/1]
root 9 0.0 0.0 0 0 ? S 22:45 0:00 [migration/2]
root 10 0.0 0.0 0 0 ? S 22:45 0:00 [kSoftirqd/2]
root 11 0.0 0.0 0 0 ? S 22:45 0:00 [watchdog/2]
root 12 0.0 0.0 0 0 ? S 22:45 0:00 [migration/3]
root 13 0.0 0.0 0 0 ? S 22:45 0:00 [kSoftirqd/3]
root 14 0.0 0.0 0 0 ? S 22:45 0:00 [watchdog/3]
root 15 0.0 0.0 0 0 ? S 22:45 0:00 [events/0]
root 16 0.0 0.0 0 0 ? S 22:45 0:00 [events/1]
root 17 0.0 0.0 0 0 ? S 22:45 0:00 [events/2]
root 18 0.0 0.0 0 0 ? S 22:45 0:00 [events/3]
root 19 0.0 0.0 0 0 ? S 22:45 0:00 [cpuset]
root 20 0.0 0.0 0 0 ? S 22:45 0:00 [khelper]
root 21 0.0 0.0 0 0 ? S 22:45 0:00 [netns]
root 22 0.0 0.0 0 0 ? S 22:45 0:00 [async/mgr]
root 23 0.0 0.0 0 0 ? S 22:45 0:00 [pm]
root 24 0.0 0.0 0 0 ? S 22:45 0:00 [sync_supers]
root 25 0.0 0.0 0 0 ? S 22:45 0:00 [bdi_default]
root 26 0.0 0.0 0 0 ? S 22:45 0:00 [kIntegrItyd/0]
root 27 0.0 0.0 0 0 ? S 22:45 0:00 [kIntegrItyd/1]
warning: bad ps syntax, perhaps a bogus '-' ? See http://Procps.sf.net/faq.html
USER PID %CPU %MEM VSZ RSS TTY STAY START TIME (COMO)
root 1 0.0 0.0 2896 1720 ? Ss 22:45 0:01 /sbin/init
root 2 0.0 0.0 0 0 ? s 22:45 0:00 [kthreadd]
root 3 0.0 0.0 0 0 ? S 22:45 0:00 [ksoftirqd/O]
root 4 0.0 0.0 0 0 ? S 22:45 0:00 [migration/0]
root 5 0.0 0.0 0 0 ? S 22:45 0:00 [watchdog/0]
root 6 0.0 0.0 0 0 ? S 22:45 0:00 [migration/l]
root 7 0.0 0.0 0 0 ? S 22:45 0:00 [kSoftirqd/1]
root 8 0.0 0.0 0 0 ? S 22:45 0:00 [watchdog/1]
root 9 0.0 0.0 0 0 ? S 22:45 0:00 [migration/2]
root 10 0.0 0.0 0 0 ? S 22:45 0:00 [kSoftirqd/2]
root 11 0.0 0.0 0 0 ? S 22:45 0:00 [watchdog/2]
root 12 0.0 0.0 0 0 ? S 22:45 0:00 [migration/3]
root 13 0.0 0.0 0 0 ? S 22:45 0:00 [kSoftirqd/3]
root 14 0.0 0.0 0 0 ? S 22:45 0:00 [watchdog/3]
root 15 0.0 0.0 0 0 ? S 22:45 0:00 [events/0]
root 16 0.0 0.0 0 0 ? S 22:45 0:00 [events/1]
root 17 0.0 0.0 0 0 ? S 22:45 0:00 [events/2]
root 18 0.0 0.0 0 0 ? S 22:45 0:00 [events/3]
root 19 0.0 0.0 0 0 ? S 22:45 0:00 [cpuset]
root 20 0.0 0.0 0 0 ? S 22:45 0:00 [khelper]
root 21 0.0 0.0 0 0 ? S 22:45 0:00 [netns]
root 22 0.0 0.0 0 0 ? S 22:45 0:00 [async/mgr]
root 23 0.0 0.0 0 0 ? S 22:45 0:00 [pm]
root 24 0.0 0.0 0 0 ? S 22:45 0:00 [sync_supers]
root 25 0.0 0.0 0 0 ? S 22:45 0:00 [bdi_default]
root 26 0.0 0.0 0 0 ? S 22:45 0:00 [kIntegrItyd/0]
root 27 0.0 0.0 0 0 ? S 22:45 0:00 [kIntegrItyd/1]
Print only the name of PID 42:
$ ps -p 3350 -o comm=
mint@mint ~ $ ps
PID TTY TIME CMD
3350 pts/0 00:00:00 bash
3981 pts/0 00:00:00 ps
mint@mint ~ $ ps -p 3350
PID TTY TIME CMD
3350 pts/0 00:00:00 bash
mint@mint ~ $ ps -p 3350 -o comm= bash
mint@mint ~ $ []
PID TTY TIME CMD
3350 pts/0 00:00:00 bash
3981 pts/0 00:00:00 ps
mint@mint ~ $ ps -p 3350
PID TTY TIME CMD
3350 pts/0 00:00:00 bash
mint@mint ~ $ ps -p 3350 -o comm= bash
mint@mint ~ $ []
0 comments:
Post a Comment