Cílem cvičení je práces s procesy a úlohami (jobs).
~printf 'PID:%s PPID:%s\n' $$ $PPID
~ps
~ps -f
~ps -o pid= -o ppid= -p $$
~pstree
~pstree -pls $$
~ssh fray1.fit.cvut.cz 'ptree $$'
~ps -e
~ps -ef
~ps -e -o
~ps -e -o pid,ppid,uid,user,gid,group,pcpu,pmem,etime,tty,args
~ps -e -o user,pid,args
~ps -e -o user,pid,args | grep "^ *$USER "
~ps -e -o user,pid,args | awk '$1 == "barinkl"
~ps -e -o user,pid,args | awk '$1 == "'"$USER"'"'
~ps -e -o user,pid,args | awk -v u="$USER" '$1 == u'
~ps -e -o user,pid,args | awk -v u="$USER" '$1 == u { print $2 }'
~pgrep -U "$USER"
fray1:~sleep 1000 & sleep 2000 & sleep 3000 &
fray1:~pgrep sleep
fray1:~pgrep -l sleep
fray1:~pgrep -l eep$
fray1:~pgrep -l ssh
fray1:~pgrep -lx ssh
fray1:~pgrep -l -U "$USER" sleep
fray1:~tty
fray1:~pgrep -l -t $(tty|sed s,/dev,,) sleep
fray1:~pgrep -l -t $(tty|cut -c5-) sleep
fray1:~pgrep -U "$USER" sleep
fray1:~ps -o pid,ppid,user,args -p "$(pgrep -U "$USER" sleep)"
fray1:~top
q
fray1:~prstat
q
fray1:~sleep 1000 &
fray1:~echo $!
fray1:~sleep 2000 & sleep 3000 &
fray1:~echo $!
fray1:~sleep 111
^C
fray1:~echo $?
fray1:~sleep 111
^\
fray1:~echo $?
fray1:~stty -a
fray1:~type kill
fray1:~help kill
fray1:~kill -l
fray1:~ps -o pid,user,args -p "$(pgrep sleep)"
fray1:~kill 12345
fray1:~kill -9 12346
fray1:~sleep 1000 & sleep 2000 & sleep 3000 &
fray1:~pgrep -l -U "$USER" sleep
fray1:~pkill -U "$USER" sleep
~sleep 1000 & sleep 2000 & sleep 3000 &
~jobs
~fg
^Z
~jobs
~bg
~jobs
~fg %1
^C
~jobs
~kill %2
~jobs