Process Command In Linux
Chapter:
Linux Commands
Last Updated:
16-11-2019 17:28:08 UTC
Program:
/* ............... START ............... */
ubuntu@ubuntu:~$ ps -a | grep -i "firefox" // ps command is used to view process and grep command to search for firefox process
31721 tty2 00:00:06 firefox
ubuntu@ubuntu:~$ ps -a
PID TTY TIME CMD
871 tty1 00:00:00 gnome-session-b
886 tty1 00:00:04 gnome-shell
1171 tty1 00:00:09 Xwayland
1333 tty1 00:00:00 ibus-daemon
1394 tty1 00:00:00 ibus-dconf
1399 tty1 00:00:00 ibus-x11
1421 tty1 00:00:00 gsd-xsettings
1422 tty1 00:00:00 gsd-a11y-settin
1427 tty1 00:00:00 gsd-clipboard
1428 tty1 00:00:00 gsd-color
...........
...........
ubuntu@ubuntu:~$ pgrep firefox // pgrep command is used to get the process id running process.
31721
/* ............... END ............... */
Output
Notes:
-
Command in linux to view running process is "ps". When typing ps command in linux it will list all the current running process.
- ps -a will all the list of details of task running in the system with name.
- Syntax : ps [options]
- Another command to get the process id of running process is "pgrep", by using the command you will get the process number of running process. For example if you type pgrep firefox, it will show the process number of firefox running. If you want to kill the process you can type "kill processNumber".
- For more information you can check the manual of command by typing man ps.
- If you want to search particular process, you can search process by using grep command after the process command.
- For example if you want to search firefox you can ps -a | grep -i "firefox" then it will list all running process which contains firefox.