Home > Tutorials > Linux Server Tutorials > Server Security: Processes and How to Terminate Them

Server Security: Processes and How to Terminate Them

Since Linux is a multi-tasking system, in which many different programs or program threads may be running simultaneously, Linux keeps track of all individual tasks and processes – much like the Task Manager within Windows. Although these processes are usually well-behaved and well-managed by Linux itself – it’s always helpful to be able to know how to view all the running processes, or stop a program if it hits a bug or a flaw.

To find out what processes are running we use the ps command. ps stands for “process status”, which generates a concise listing of your own processes.

[email protected] [~]# ps
 252270 ? 00:00:00 bash
 252341 ? 00:00:00 ps

The information in the first column, titled PID, is the Process ID number, which is unique and which Linux uses to identify that particular process. You must know the PID in order to be able to kill a process.

The TTY column shows you which terminal the process was started from.

The STAT column gives you the current status of the process. The two most common entries in the status column are S for sleeping and R for running. A sleeping process is one that isn’t currently active, however do take note that a process can switch from sleeping to running within a matter of seconds.

The TIME column shows the amount of system time used by the process. Clearly, neither of our processes are taking up any real system time in our example above.

Finally we come to the COMMAND column – which contains the name of the program that is running. This will usually be the command you typed at the command line, however sometimes the command you type starts one or more child processes, and in this case you would see these additional processes show up as well, without ever actually having to have typed them in yourself.

If you are logged in as root, you will see a list of all the processes on your system. An ordinary user will simply see the processes that are running under their account only.

One extremely useful option with the ps command is the u argument. Although technically the u argument stands for “user” – it actually displays much more information than just the username. For example:

[email protected] [~]# ps u
user 252270 0.0 0.0 10952 1424 ? S 09:34 0:00 -jailshell
user 270853 0.0 0.0 10480 924 ? R+ 09:40 0:00 ps u

As you can see in addition to the username in the USER column, we now also have the CPU column – which shows you what percentage of your computer’s processing power is being used by the process, and MEM – which shows you what percentage of your computers memory is being used by the process.


About Michael Boguslavskiy

Michael Boguslavskiy is a full-stack developer & online presence consultant based out of New York City. He's been offering freelance marketing & development services for over a decade. He currently manages Rapid Purple - and online webmaster resources center; and Media Explode - a full service marketing agency.

Check Also

Understanding The <BASE> Tag in 2018

The <BASE> tag has been a part of HTML for decades now, and little has ...

Like every other website, this site uses cookies to analyze our traffic. Cookies may also be utilized by our advertisers and partners. By using this website you agree to the use of said cookies. More Information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings, continuing to navigate past this message, or you click "Accept" below then you are consenting to the use of cookies on the Rapid Purple website.