command to see what processes are running in linux
Every solar day, developers apply various applications and run commands in the terminal. These applications can include a browser, code editor, terminal, video conferencing app, or music thespian.
For each of these software applications that you open up or commands you run, it creates a process or chore.
One beautiful feature of the Linux operating system and of modern computers in full general is that they provide back up for multitasking. So multiple programs can run at the same time.
Take you lot ever wondered how you can check all the programs running on your motorcar? Then this article is for yous, equally I'll show you how to list, manage, and kill all the running processes on your Linux motorcar.
Prerequisites
- A Linux distro installed.
- Bones knowledge of navigating effectually the control-line.
- A smile on your face :)
A Quick Introduction to Linux Processes
A process is an case of a running figurer program that yous tin discover in a software awarding or command.
For instance, if yous open up your Visual Studio Lawmaking editor, that creates a process which volition but stop (or die) once you terminate or close the Visual Studio Code awarding.
Besides, when you run a command in the concluding (like scroll ifconfig.me
), information technology creates a process that volition simply stop when the command finishes executing or is terminated.
How to Listing Running Processes in Linux using the ps
Control
You can list running processes using the ps
control (ps means process condition). The ps
command displays your currently running processes in real-time.
To examination this, just open your terminal and run the ps
command like so:
This will display the process for the current shell with four columns:
- PID returns the unique process ID
- TTY returns the terminal type you lot're logged into
- Time returns the total corporeality of CPU usage
- CMD returns the name of the command that launched the procedure.
You tin can choose to display a certain set of processes past using whatsoever combination of options (similar -A
-a
, -C
, -c
, -d
, -E
, -e
, -u
, -X
, -10
, and others).
If you specify more than i of these options, then all processes which are matched by at to the lowest degree 1 of the given options will exist displayed.
Typeman ps
in your terminal to read the manual for theps
command, which has a complete reference for all options and their uses.
To display all running processes for all users on your machine, including their usernames, and to show processes not attached to your concluding, y'all tin can use the command below:
ps aux
Hither's a breakdown of the command:
-
ps
: is the process status command. -
a
: displays data nigh other users' processes equally well as your own. -
u
: displays the processes belonging to the specified usernames. -
ten
: includes processes that do not have a decision-making terminal.
This volition brandish the process for the current shell with eleven columns:
- USER returns the username of the user running the process
- PID returns the unique process ID
- %CPU returns the per centum of CPU usage
- %MEM returns the per centum memory usage
- VSV returns the virtual size in Kbytes
- RSS returns the resident set size
- TT returns the control terminal proper name
- STAT returns the symbolic procedure state
- STARTED returns the time started
- CMD returns the command that launched the process.
How to List Running Processes in Linux using the top
and htop
Commands
Yous can also use the top
task manager control in Linux to run into a existent-fourth dimension sorted list of meridian processes that utilise the most memory or CPU.
Type acme
in your concluding and you'll become a upshot like the 1 you lot see in the screenshot below:
You can type q
to go out the session.
An culling to height
is htop
which provides an interactive system-monitor to view and manage processes. Information technology also displays a existent-fourth dimension sorted listing of processes based on their CPU usage, and you tin easily search, filter, and kill running processes.
htop
is not installed on Linux by default, and then yous need to install information technology using the command beneath or download the binaries for your preferred Linux distro.
sudo apt update && sudo apt install htop
Just type htop
in your terminal and you'll get a result like the i you lot see in the screenshot below:
How to Kill Running Processes in Linux
Killing a procedure means that y'all terminate a running application or control. You can kill a procedure by running the impale
command with the process ID or the pkill
command with the process name like so:
kill [PID]
or
pkill [COMMAND]
To notice the process ID of a running process, you tin can use the pgrep
command followed by the name of the process like so:
pgrep iTerm2
To kill the iTerm2 process in the screenshot in a higher place, we will utilise whatever of the commands below. This volition automatically stop and close the iTerm2 process (awarding).
impale 25781
or
kill iTerm2
Conclusion
When yous listing running processes, it is usually a long and clustered listing. You lot can pipe information technology through less to display the command output i page at a time in your final similar so:
ps aux | less
or display merely a specific process that matches a item name like so:
ps aux | grep Chrome
I hope that y'all now understand what Linux processes are and how to manage them using the ps
, superlative
, and htop
commands.
Make sure to bank check out the manual for each command by running man ps
, homo pinnacle
, or homo htop
respectively. The manual includes a comprehensive reference you lot can cheque if you need any more help at any point.
Cheers for reading – thank you! đź’™
Learn to code for gratuitous. freeCodeCamp'south open source curriculum has helped more than 40,000 people get jobs every bit developers. Go started
Source: https://www.freecodecamp.org/news/linux-list-processes-how-to-check-running-processes/
0 Response to "command to see what processes are running in linux"
Postar um comentário