Top
top is a tool to interactively or in batch gather information on
processes that run on a system. It has some rather neat features
that are not so well known.
This is not a tutorial, just a collection of tricks. You can find a good tutorial on the basic use of top online.
Note that in the tips below, the commands are case sensitive.
- To select the column on which the processes are sorted, use
<to go one column to the left,>to go a column to the right. To highlight the column top currently sorts on, pressx(pressxagain to deactivate highlighting). To reverse the sort order, pressR. - You can display additional fields besides the default ones,
pressing
fbrings up a screen to select/deselect fields. Press space to select/deselect. - A few useful fields that are not shown by default, but that
can be quite useful are:
nTH = Number of ThreadsP = Last Used Cpu (SMP)WCHAN = Sleeping in Function
- To see all threads of a process, press
H. - If you only want to see processes owned by a given user, press
u, and enter the user at the prompt. To exclude processes from a user, use!, e.g., to see all processes not owned byroot, use!root. - To search for a string in the screen, press
L, and use&to find again. - To filter the processes show, press either
oorO(case insensitive/case sensitive) and enter a search criterion. To remove all filter criteria, press=. These are a few examples of filters you can apply:USER=vscwill show the processes of users that have an ID containing the string ‘vsc’.%MEM>0.5: show processes that consume more than 0.5 % of the available memory.
- To change the delay time, i.e., the time between screen
refreshes, press
dand enter the time in seconds. - To see summary information for cores, rather than the whole
system, press
1, to see summary information per socket, press2. - To save a configuration to disk, press
W. This file is.toprcin your home directory.