General Information
Process wrangling. Get em cow-poke and watch out for zombies.
Grep for processes and return the PID.
Search processes for httpd
pgrep httpd -l
Search for all processes being run by the user called “user”
pgrep -u user -l
All processes not owned by the root user
pgrep -v -u root -l
All processes, user defined display options
ps -eo pid,comm,nice
GNU Style Options
ps -elf
BSD Style Options
ps aux
Load average
Get the number of CPUs
grep -c proc /proc/cpuinfo
View load averages
w OR uptime 17:03:49 up 2:02, 1 user, load average: 0.00, 0.01, 0.04
Percentage of total processing power in use = load average / (# of cpus)
Open top
top
Interactive commands
Start top with a screen update delay of 2 seconds
top -d 2
Highest priority ⇒ -20 (the least nice to other processes)
Lowest priority ⇒ 19 (the most nice to other processes)
Default nice level if nice run, but level not specified ⇒ 10
Start program with a nice level of 5
nice -n 5 httpd
Change nice level of a running process to -5
renice -n -5 2879
Change nice level of all running httpd processes to -10
renice -n -10 $(pgrep httpd)
List kill signals
kill -l
Kill process by name (instead of PID)
pkill httpd
Remove a user's ssh session (kick user off system)
pkill -u rjones sshd
Kill all processes started from a specific terminal
pkill -t pts/1
Stop a process that is job #1
kill -SIGSTOP %1
Contine the process that is job #1
kill -SIGCONT %1
Kill an individual process with PID 2594
kill -SIGKILL 2594