How to check running process in Unix using command line

See all UNIX related articles/faq
I am a new sysadmin for the Unix operating system. How do I check running process in Unix using the command line option?

One can use the Unix command line or terminal app to display a running process, change their priorities level, delete process and more. This page shows how to use various commands to list, kill and manage process on Unix.

Check running process in Unix

The procedure to monitor the running process in Unix using the command line is as follows:

  1. Open the terminal window on Unix
  2. For remote Unix server use the ssh command for log in purpose
  3. Type the ps aux command to see all running process in Unix
  4. Alternatively, you can issue the top command to view running process in Unix

How to manage processes from the Unix terminal

The ps command is a traditional Unix command to lists running processes. The following command shows all processes running on your system:
ps -aux
sudo ps -a

How to Manage Processes from the Unix Terminal
The process ID (PID) is essential to kill or control process on Unix. For example consider the following outputs:

vivek 43126  0.0  0.0 13160 8452  -  S    10:59   0:00.03 vim


  1. vivek – User name
  2. 43126 – PID (Unix process ID)
  3. 10:59 – Process start time
  4. vim – Actual process or command

There may be too many processes. Hence, it uses the following less command/more command as pipe to display process one screen at a time:
ps -aux | more
sudo ps -aux | less

Press q to exit from above Unix pagers. You can search for a particular Unix process using grep command/egrep command:
ps aux | grep nginx
sudo ps aux | grep vim
sudo ps -aux | egrep 'sshd|openvpn'

pgrep command

Many variants of Unix comes with the pgrep command to search/find process. The syntax is:
pgrep process
sudo pgrep sshd
pgrep vim
pgrep -l nginx

Given a search term, Unix pgrep command shows the process IDs that match it
The -l option passed to the pgrep command to display long format and process name too.

top command

The top command is another highly recommended method to see your Unix servers resource usage. One can see a list of top process that using the most memory or CPU or disk.
sudo top
sudo top [options]

Check running process in Unix using top command

Unix kill command

Want to kill a process? Try kill command. The syntax is:
kill pid
kill -signal pid

Find PID using ps, pgrep or top command. Say you want to kill a PID # 50797, run:
kill 50797
For some reason if the process can not be killed, try forceful killing:
kill -9 50797
kill -KILL 50797
Unix kill command to kill a process, given its process ID

pkill command

If you wish to kill a process by name, try pkill command. The syntax is:
pkill processName
pkill vim
pkill firefox
pkill -9 emacs
sudo pkill -KILL php7-fpm

killall command

The killall command kills processes by name, as opposed to the selection by PID as done by kill command:
killall vim
killall -9 emacs

Unix kill a process given its name

nice and renice command

The primary purpose of the nice command is to run a process/command at a lower or higher priority. Use the renice command to alter the nice value of one or more running Unix processes. The nice value can range from -20 to 19, with 19 being the lowest priority. Say, you want to compile software on a busy Unix server. You can set a very low priority, enter:
nice -n 13 cc -c *.c &
Set a very high priority for a kernel update. Before rebooting Unix server, run:

nice --10 wall <<end
System reboots in 5 minutes for Unix kernel update! 
Save all your work!!!
-- Sysadmin

To change the priority of a running process, type the following:
renice {Priority} -p {PID}
renice {Priority} {PID}
pgrep vim
renice 10 69947
sudo renice -10 $(pgrep vim)

Unix change the priority of a running process


This page shows how to manage the process on the Unix terminal. For further info see man pages or our example pages:

🥺 Was this helpful? Please add a comment to show your appreciation or feedback.

nixCrat Tux Pixel Penguin
Hi! 🤠
I'm Vivek Gite, and I write about Linux, macOS, Unix, IT, programming, infosec, and open source. Subscribe to my RSS feed or email newsletter for updates.

1 comment… add one
  • Dr. Grep May 1, 2018 @ 6:25

    I always used on my OpenBSD and FreeBSD unix servers:

    Be careful about the killall on Oracle/Sun Solaris Unix box ;)

Leave a Reply

Your email address will not be published. Required fields are marked *

Use HTML <pre>...</pre> for code samples. Your comment will appear only after approval by the site admin.