Process management Flashcards
List processes
ps -aux/ ps -ef[H] hierarchy
ps -u- list user processes
first process will get id=1
List processes with their state
ps -el states: S -sleep T- terminated (ctrl+z) X- dead (should not be seen) Z- zombie I -idle R -running
Set priority of processes
nice [from -20 to 19]
nice -n 10 ping google.com
(The higher the number the higher the priority)
Alter priority of running process
renice -n -15 2345 [PID]
Display processes in real time
top keys: k-kill process r-renice process Sorting: M- %MEM N- PID P- %CPU T- TIME+
Look for process based on name
pgrep -a ssh- lists pids and service paths
pgrep httpd only lists pids related to httpd
pgrep -u- list pids of current user
Check how long takes a process to run
time ping -n 10 google.com
Kill a process based on name
pkill ping
pkill -x httpd -to kill processes match exactly to httpd
List open files
lsof
Location in pseudo FS related to cpu and memory
cat /proc/cpuinfo
cat /proc/meminfo
Tell how long the system has been running
uptime (1m, 5m, 15 m)
Report system activity info
sar -u for CPU utilization
sar -A -report for all devices
sar -b -IO stat
sar -d -for each block device
Configure kernel params in runtime
sysctl -a (display all values available)
Kill process
kill -9 1234 [pid]
kill 1234
kill -l- get the list of signal to be passed to kill command
Amount of RAM available+swap
free -m