A process is a task that your Linux machine is currently working on. For example, when you open a browser, your machine creates a process for it.
Let’s try to understand this by running a simple command such as ps
. Here’s the syntax:
ps [options]
When you run ps
in your shell, it will give you the following output.
PID TTY TIME CMD
8 tty1 00:00:00 bash
71 tty1 00:00:00 ps
ps
gives you information about active processes. By default, it displays all processes associated with the same effective user.
It displays the:
PID
TTY
TIME
in hh:mm:ss
formatCMD
Output is unsorted by default.
For more information on the processes, you can use the ps aux
command.
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 8936 100 ? Ssl Sep27 0:00 /init
root 7 0.0 0.0 8936 96 tty1 Ss Sep30 0:00 /init
kedar 8 0.0 0.0 18076 2464 tty1 S Sep30 0:00 -bash
kedar 81 0.0 0.0 18664 1896 tty1 R 00:53 0:00 ps aux
In the command aux
:
a
represents all usersu
represents the user/ownerx
displays processes executed outside of the terminalIt also displays some extra fields in results as compared to our previous command, which are:
USER
represents the user that initiated the process.
%CPU
is the CPU utilization of the process.
%MEM
shows the memory usage.
VSZ
means the virtual memory size of the process in KiB.
RSS
is the non-swapped physical memory that a process has used (in kilobytes).
STAT
shows the process state.
START
represents the time at which the command started.
To stop the process, you can use the kill command. Here’s the syntax:
kill PID
For example, kill 20
.
To learn more about the ps
command or any other commands in Linux, I encourage you to try the man
(manual) command.
The syntax is as follows:
man command