This information will explore making use of the best command in Linux to come across precise information and facts about running processes in your system.
Simple Leading Usage
To use the prime utility in Linux, launch a terminal session and enter the command prime.
An illustration output of the top command is:
The output is divided into two parts:
The upper portion reveals the source usage these kinds of as Memory, CPU usage, and disk usage.
The reduce portion reveals details about the functioning procedures. This sort of data contain the Process ID, consumer, and course of action name.
How to Filter Particular Procedures
To filter the best output to a unique course of action, press the O key and enter the entry as COMMAND=title, wherever the name refers to the process name.
For instance, to filter for the method:
Press ENTER, and the leading utility will filter the procedures to systemd only.
You can also spotlight the particular approach even though preserving other processes in check out. To do this, push the L crucial and research for a string.
For case in point:
How to Filter Consumer Procedures
The Leading output utility also permits us to filter procedures spawned by a distinct user. To do this, we use the -u flag followed by the username.
For case in point,
The command displays only the processes owned by the ubuntu person.
How to Form Procedures by %CPU
We can also form the top rated output by the CPU utilization proportion. To do this, press the Change + P command.
The output is sorted in ascending order.
How to Transform Refresh Interval
By default, the top will refresh the output just about every 3 seconds. To modify this value, push the d key even though the top rated is functioning.
How to Present the Path to a Binary
To display the path to the command that initiated a distinct method, push the c critical:
How to Save The Output to a File
We can also help you save the output of the file by applying redirection symbols. For case in point, to export the best output for 10 minutes, use the command:
best -n 3 -b > top_output.log
The -n specifies the number of iterations top must generate in advance of terminating.
The -b flag begins major in batch mode, which constantly processes the output right up until the greatest iterations are achieved (specified in -n flag).
The top is a great utility for process directors and any person who wishes to know what processes use system sources. To discover extra about major, look at the documentation.