Managing Running Processes

Managing Running Processes

A process is a running instance of a command. For example, there may be one vi command on the system. But if vi is currently being run by 15 different users, that command is represented by 15 different running processes.

Listing processes with ps

[COMMAND ps]

ubuntu@ip-172-31-24-188:~$ ps u
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
ubuntu    1063  0.0  0.3  21360  3960 pts/0    Ss   01:43   0:00 -bash
ubuntu    1165  0.0  0.1  17164  1304 pts/0    R+   03:11   0:00 ps u

To page through all the processes running on your Linux system for the current user, add the pipe (|) and the less command to ps ux:
$ ps ux | less
To page through all processes running for all users on your system, use the ps aux
command as follows:
$ ps aux | less

Starting background processes

ubuntu@ip-172-31-24-188:~$ find /usr > /tmp/allusrfiles &
[1] 1192
ubuntu@ip-172-31-24-188:~$ jobs
[1]+  Running                 find /usr > /tmp/allusrfiles &
ubuntu@ip-172-31-24-188:~$ jobs
[1]+  Done                    find /usr > /tmp/allusrfiles

Killing and Renicing Processes

[COMMAND kill]
[COMMAND killall]
[COMMAND systemctl]

# kill -1 1833
# systemctl reload httpd

$ killall -9 testme