Viewing processes commands Flashcards
(15 cards)
1what is the ps command?
used to get information about processes that are currently running on the system
what happens when you run the ps command without arguments?
displays a list of current running processes in the shell
what does the -f option do when ran in ps?
gives more infor such as uid ppid
explain each part of the output from the following command?
[root@server1 ~]# ps -f
UID PID PPID C STIME TTY TIME CMD
root 2159 2156 0 16:18 tty2 00:00:00 -bash
root 2233 2159 3 16:28 tty2 00:00:00 ps -f
[root@server1 ~]#_
Uid: displays the user who started the processes
PID: is the processes ID
PPID: is the parent processes ID
Stime: the time the processes was started
tty: which terminal its running in
cmd the command that started each processes.
c how many processor cycles has been ran on the cpu for that process
what does the -e option do when ran with the ps command?
shows the entire list of processes and daemons that are running across all terminals
what is the following command doing
ps -ef | less
[root@server1 ~]# ps -ef | less
UID PID PPID C STIME TTY TIME CMD
root 1 0 0 21:22 ? 00:00:00 /usr/lib/systemd/systemd
root 2 0 0 21:22 ? 00:00:00 [kthreadd]
root 3 2 0 21:22 ? 00:00:00 [ksoftirqd/0]
root 5 2 0 21:22 ? 00:00:00 [kworker/0:0H]
root 6 2 0 21:22 ? 00:00:00 [kworker/u128:0]
root 7 2 0 21:22 ? 00:00:00 [migration/0]
root 8 2 0 21:22 ? 00:00:00 [rcu_bh]
root 9 2 0 21:22 ? 00:00:00 [rcu_sched]
root 10 2 0 21:22 ? 00:00:00 [watchdog/0]
show all the current proccesses and daemons that are running across all the shells
which daemon is the parenet proccesses of [ksoftirqd/0]
[root@server1 ~]# ps -ef | less
UID PID PPID C STIME TTY TIME CMD
root 1 0 0 21:22 ? 00:00:00 /usr/lib/systemd/systemd
root 2 0 0 21:22 ? 00:00:00 [kthreadd]
root 3 2 0 21:22 ? 00:00:00 [ksoftirqd/0]
root 5 2 0 21:22 ? 00:00:00 [kworker/0:0H]
root 6 2 0 21:22 ? 00:00:00 [kworker/u128:0]
root 7 2 0 21:22 ? 00:00:00 [migration/0]
root 8 2 0 21:22 ? 00:00:00 [rcu_bh]
root 9 2 0 21:22 ? 00:00:00 [rcu_sched]
root 10 2 0 21:22 ? 00:00:00 [watchdog/0]
[kthreadd]
what does the following command do
[root@server1 ~]# ps –ef | grep bash
user1 2094 2008 0 14:29 pts/1 00:00:00 -bash
root 2159 2156 0 14:30 tty2 00:00:00 -bash
root 2294 2159 0 14:44 tty2 00:00:00 grep –-color=auto bash
[root@server1 ~]#_
searchs for proccess that are started in the bash shell
what does the option l do in the ps command?
lists more info
what does the following output mean for F S also explains what each proccess processes state is?
[root@server1 ~]# ps –l
F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD
4 S 0 2159 2156 0 80 0 - 1238 wait tty2 00:00:00 bash
4 R 0 2295 2159 2 80 0 - 744 - tty2 00:00:00 ps
1 D 0 2401 1 0 80 0 - 1500 disk_sleep ? 00:00:00 iowaitd
0 Z 0 2412 2159 0 80 0 - 0 - tty2 00:00:00 cumm
1 T 0 2450 2159 0 80 0 - 900 - tty2 00:00:00 alpha
[root@server1 ~]#_
F is the the process flag
S is the proccess state
(S) in the bash cmd means its not being ran @ current time
(R) in ps means it is currently running
(D) in iowaited means its waiting for disk access or space
(T) in alpha means it is either stoped or being trace be another process
(Z) in cumm means it is a zombie processes and has is waiting to be release by parent
PRI is the process priority is messure between the 0 mean high while 127 means low
NI is nice value used to affect process priority is measue between -20 and 19
addr is the memory address of the process
the wchan shows what the process is waiting for while its sleeping
then the SZ is the size of the process in memory
what does the following berkeley style options do in the ps command | x a
X shows the process that do not run on a terminal
A is all processes that are being ran across all terminals
what is the following command doing
ps ax | head -11
it is showing a list of all the process that are runnining across all terminals and that are not being ran in the current terminal
then its pipe to head -11 meaning it will only show the first 10 outputs
what are the process states that arise from the following command outputs
[root@server1 ~]# ps ax | head -5
PID TTY STAT TIME COMMAND
1 ? Sw 0:01 /usr/lib/systemd/systemd
2 ? Sn 0:00 [kthreadd]
3 ? S 0:00 [migration/0]
4 ? S< 0:00 [ksoftirqd/0]
the w in /usr/lib/systemd/systemd means that it has no contents in memory
the N in [kthreadd] means its a low priority process.
the < in [ksoftirqd/0] means its high priority process
what does the pstree command do?
traces the path on proccess via the PPIDwha
what does the top command do?
shows a screen that is listed in processor time and is interactive