How to Install ERPNext on Rocky Linux 9 2

How to Use top Command on Linux

The Linux top (table of process) command is a useful way to track information about your computer’s resource usage and the running processes’ in the background. Even with it’s basic interface, it can also support color, highlighting and even some basic graphs.

Top command gives users a dashboard of different processes and other system metrics. This information that is provided by top is useful for a system administrator as it helps track down problems before they emerge. 

At the start of using top, the interface may seem off-putting and all-up-in-your-face, but that can easily be changed so that you can choose which display would suit your needs.

Prerequisites 

Launch the terminal using the Ctrl+Alt+T key combination.

Accessing the Default Display

First, to start, type in top and hit “enter” to access the default view of the command.

top command lowercase sensitve

Once you input the top command, the default display should look something like this:

Default dashboard of top command

Here you can see that in the upper part of the display, it shows the statistics about the process and storage usage of your computer. The lower half of the display shows the list of programs that are currently running. To navigate the display, simply use the arrow keys or page up and down keys. 

Press “Q” to quit the window.

top Command Syntax and Option

1. Help Option

This function helps you access the help menu option to see the various key functions and shortcuts to use when navigating the dashboard. Some versions of Linux might have different shortcut commands for certain keys, so be sure to check the help option first.

press “H” to access the command help file

Help menu option top command

2. Changing the Numeric Units

Press capital “E” to cycle through units used to display memory values kibibytes, mebibytes, gibibytes, tebibytes, pebibytes, and exbibytes. If you want to track specific memory usage, this is a helpful way of doing it.

Changing numeric units top command

By pressing “E” you can see on the picture that the MiB changed to GiB.

3. Changing the Summary Contents

press “I” to toggle on or off the log summary line.

Changing summary contents top command

Pressing “T” once, you can swap the CPU display to simple ASCII graphs.

Memory usage top command

If you press “T” again, the graph display changes into solid block characters. Solid block characters will give a rough estimate of how much of your CPU  is being used depending on the available resources.

CPU usage top command

By pressing “T” once more, you can remove the CPU display and task summary line completely. You can do this in order to keep your current display neat and tidy once you are done checking the CPU display and task summary line.

Hide top line top command

Pressing “M” would change the memory display to an ASCII graph.

Graph view top command

When you press “M” again, it turns the memory display to solid block characters.

Solid block view top command

By pressing “M” again, you can remove the memory display line.

Remove memory line display top command

3. Changing the Color and Highlighting

press “Z” in order to add color to the display.

Color and highlighting

You can toggle which color preference you want from red or white displays.

By default, the process list is sorted by the % CPU column. You can change it by pressing “P” for the % CPU column. Pressing “M” for the % MEM column. Pressing “N” for the PID column. Then by pressing “T” for the TIME+ column.

Pressing “Y” will highlight the running tasks in the process list. Pressing “X” will highlight the column used to sort the process list. Then if you press “B” you can then toggle between bold and reverse text.

Highlighted top command

The picture above shows the selected TIME+ column.

4. Display Active Tasks

when you press “i” you can choose to only display the active tasks. Tracking which active tasks are running will be able to help you diagnose your system if you ever come across a problem like a program using too much memory causing your system to slow down.

Display running programs

5. Changing the priority of a process

press “R” to display the PID to renice.

Changing priority of process

You will then be prompted for the PID as seen in the picture above. The value of “7800” happened to be the PID of Firefox.

PID user top command

In the picture above, you need to assign the new nice value to apply to the process. As you can see, I typed 10. After you press “enter” the new nice value is applied to the process immediately.

6. Killing a Process

press “K” to kill a process. After pressing “K” you will be prompted to type the PID that you want to kill.

Killing a process

After pressing “enter” you will be offered the option to type the signal you want to send. If you leave it blank and hit “enter” again, top sends the SIGTERM(kill) signal.

Killing process confirmation

The article should have guided you to the basic functions and options on how to use the top command. Make sure you always have the latest version of Ubuntu in order to follow the guide. In case of any more questions, feel free to comment them down below.

If this guide helped you, please share it. ?

Leave a Reply
Previous Article
How to Install ERPNext on Rocky Linux 9 3

How to Use echo Command in Linux

Next Article
How to Install ERPNext on Rocky Linux 9 4

How to Use pushd Command in Linux

Related Posts