Video:How to Use the Top Command in Linuxwith Zoya Popova
The Linux top command will show real-time information and statistics about your system. Watch this how-to video from About.com to learn how to run the top command and sort through all the information given.See Transcript
Transcript:How to Use the Top Command in Linux
Hi, I'm Zoya Popova for About.com, and today I'm going to show you how to use the top command in Linux.
The Linux Top Command Shows Process Information
When you run the top command, it displays real-time information about your system.
In the upper portion of the window, you can see system summary information, such as the time the system has been up, the number of total, running, and sleeping processes, and CPU and memory usage statistics. You can toggle the display of this information by using single-key commands. For example, if you hit "l", it will hide the uptime and load average information. Hitting "l" again will make it reappear. Similarly, hitting "t" will toggle the display of tasks and CPU information. Hitting "m" will toggle the display of memory information.
In the bottom portion of the window is the list of the processes that are currently being managed by your system. In this table, you can see information such as process IDs, the command names that launch each process, CPU usage and memory consumption, and the time each process has been running.
Sort the Top Command Display Information
By default, the processes are arranged by CPU usage, from greatest to least. But you can also sort processes by other criteria. To do this, once again, use single-key commands. For example, hitting "M" will let you arrange your processes by memory used. "T" will sort by running time. "N" will list the processes in the order of their numeric process IDs. And if you want to return to the default sorting by CPU usage, hit "P".
The number of processes you see displayed here is limited by the physical size of the window. To see information about a larger number of tasks, simply expand the window. You can also set the number of tasks you want displayed by using the interactive n command. Hitting "n" will prompt you to enter a number, so if you enter "10", it will show you the top ten tasks. To go back to displaying the maximum possible number of tasks, enter "0" as your value.
Change the Update Time in Linux
The process information in the top command is updated at an interval called "delay time". Here in our system, it is every 3 seconds by default. You can change delay time using the interactive s or d command. Simply hit "s" or "d", and enter the desired delay time in seconds. You can also get immediate updates of the information by hitting the space bar.
To quit top, hit "q".
For a detailed description of what you can do with the top command, refer to its manual by entering man top
And this is it for us for today. Thank you for watching, and for more information, please visit us at About.com.