Latif Basics Part22 Process Management -PS and KILL

Опубликовано: 16 Декабрь 2025
на канале: Latif Shaik (latiftechnotes)
19
0

20220210 134620
ps -- display snapshot current running process
ps - report a snapshot of the current processes.
every process must has pid
and pid is may not same every time

pid - process id

ppid - parent process id

some process may have child process

P1 -process
P11 -child process to p1

P1 pid -1012
P11 pid -1132 ppid-1012

man ps


ps -e
ps -ef
ps -aux
ps -a

ps -oe

EXAMPLES
To see every process on the system using standard syntax:
ps -e
ps -ef
ps -eF
ps -ely

To see every process on the system using BSD syntax:
ps ax
ps axu

To print a process tree:
ps -ejH
ps axjf

To get info about threads:
ps -eLf
ps axms
To get security info:
ps -eo euser,ruser,suser,fuser,f,comm,label
ps axZ
ps -eM

To see every process running as root (real & effective ID) in user
format:
ps -U root -u root u

To see every process with a user-defined format:
ps -eo pid,tid,class,rtprio,ni,pri,psr,pcpu,stat,wchan:14,comm
ps axo stat,euid,ruid,tty,tpgid,sess,pgrp,ppid,pid,pcpu,comm
ps -Ao pid,tt,user,fname,tmout,f,wchan

Print only the process IDs of syslogd:
ps -C syslogd -o pid=

Print only the name of PID 42:
ps -q 42 -o comm=
-----------------------------------------------
ps

ps -e
ps -ef

ps -aux

ps -eo user,pid,ni,cmd

ps -eo user,pid,ni,cmd | grep gedit
root 5319 0 /usr/bin/gedit --gapplication-service
root 5406 0 grep --color=auto gedit
kill 5319
ps -eo user,pid,ni,cmd | grep gedit
root 5428 0 grep --color=auto gedit
ps -eo user,pid,ni,cmd | grep gedit
root 5437 0 /usr/bin/gedit --gapplication-service
root 5446 0 grep --color=auto gedit

to terminate process

kill pid



sleep 1000 &
[1] 5723

ps -eo user,pid,ni,cmd | grep sleep
student+ 5723 0 sleep 1000
root 5732 0 sleep 60
student+ 5734 0 grep --color=auto sleep

kill 5723

ps -eo user,pid,ni,cmd | grep sleep
root 5743 0 sleep 60
student+ 5745 0 grep --color=auto sleep
[1]+ Terminated sleep 1000
---------------------------------------------