Home
Main website
Display Sidebar
Hide Ads
Recent Changes
View Source:
top(1)
Edit
PageHistory
Diff
Info
LikePages
TOP !!!TOP NAME SYNOPSIS DESCRIPTION COMMAND-LINE OPTIONS FIELD DESCRIPTIONS INTERACTIVE COMMANDS The Field and Order Screens Configuration Files NOTES FILES SEE ALSO BUGS AUTHOR ---- !!NAME top - display top CPU processes !!SYNOPSIS __top__ [[__-__] [[__d__ ''delay''] [[__p__ ''pid''] [[__q__] [[__c__] [[__C__] [[__S__] [[__s__] [[__i__] [[__n__ ''iter''] [[__b__] !!DESCRIPTION __top__ provides an ongoing look at processor activity in real time. It displays a listing of the most CPU-intensive tasks on the system, and can provide an interactive interface for manipulating processes. It can sort the tasks by CPU usage, memory usage and runtime. can be better configured than the standard top from the procps suite. Most features can either be selected by an interactive command or by specifying the feature in the personal or system-wide configuration file. See below for more information. !!COMMAND-LINE OPTIONS __d__ Specifies the delay between screen updates. You can change this with the __s__ interactive command. __p__ Monitor only processes with given process id. This flag can be given up to twenty times. This option is neither available interactively nor can it be put into the configuration file. __q__ This causes __top__ to refresh without any delay. If the caller has superuser priviledges, top runs with the highest possible priority. __S__ Specifies cumulative mode, where each process is listed with the CPU time that it ''as well as its dead children'' has spent. This is like the __-S__ flag to ps(1). See the discussion below of the __S__ interactive command. __s__ Tells __top__ to run in secure mode. This disables the potentially dangerous of the interactive commands (see below). A secure __top__ is a nifty thing to leave running on a spare terminal. __i__ Start __top__ ignoring any idle or zombie processes. See the interactive command __i__ below. __C__ display total CPU states in addition to individual CPUs. This option only affects SMP systems. __c__ display command line instead of the command name only. The default behaviour has been changed as this seems to be more useful. __n__ Number of iterations. Update the display this number of times and then exit. __b__ Batch mode. Useful for sending output from top to other programs or to a file. In this mode, __top__ will not accept command line input. It runs until it produces the number of iterations requested with the __n__ option or until killed. Output is plain text suitable for display on a dumb terminal. !!FIELD DESCRIPTIONS __top__ displays a variety of information about the processor state. The display is updated every 5 seconds by default, but you can change that with the __d__ command-line option or the __s__ interactive command. __uptime__ This line displays the time the system has been up, and the three load averages for the system. The load averages are the average number of process ready to run during the last 1, 5 and 15 minutes. This line is just like the output of uptime(1). The uptime display may be toggled by the interactive __l__ command. __processes__ The total number of processes running at the time of the last update. This is also broken down into the number of tasks which are running, sleeping, stopped, or undead. The processes and states display may be toggled by the __t__ interactive command. __CPU states__ Shows the percentage of CPU time in user mode, system mode, niced tasks, and idle. (Niced tasks are only those whose nice value is negative.) Time spent in niced tasks will also be counted in system and user time, so the total will be more than 100%. The processes and states display may be toggled by the __t__ interactive command. __Mem__ Statistics on memory usage, including total available memory, free memory, used memory, shared memory, and memory used for buffers. The display of memory information may be toggled by the __m__ interactive command. __Swap__ Statistics on swap space, including total swap space, available swap space, and used swap space. This and __Mem__ are just like the output of free(1). __PID__ The process ID of each task. __PPID__ The parent process ID each task. __UID__ The user ID of the task's owner. __USER__ The user name of the task's owner. __PRI__ The priority of the task. __NI__ The nice value of the task. Negative nice values are higher priority. __SIZE__ The size of the task's code plus data plus stack space, in kilobytes, is shown here. __TSIZE__ The code size of the task. This gives strange values for kernel processes and is broken for ELF processes. __DSIZE__ Data + Stack size. This is broken for ELF processes. __TRS__ Text resident size. __SWAP__ Size of the swapped out part of the task. __D__ Size of pages marked dirty. __LC__ Last used processor. (That this changes from time to time is not a bug; Linux intentionally uses weak affinity. Also notice that the very act of running top may break weak affinity and cause more processes to change current CPU more often because of the extra demand for CPU time.) __RSS__ The total amount of physical memory used by the task, in kilobytes, is shown here. For ELF processes used library pages are counted here, for a.out processes not. __SHARE__ The amount of shared memory used by the task is shown in this column. __STAT__ The state of the task is shown here. The state is either __S__ for sleeping, __D__ for uninterruptible sleep, __R__ for running, __Z__ for zombies, or __T__ for stopped or traced. These states are modified by trailing ____ for a process with negative nice value, __N__ for a process with positive nice value, __W__ for a swapped out process (this does not work correctly for kernel processes). __WCHAN__ depending on the availablity of either ''/boot/psdatabase'' or the kernel link map ''/boot/System.map'' this shows the address or the name of the kernel function the task currently is sleeping in. __TIME__ Total CPU time the task has used since it started. If cumulative mode is on, this also includes the CPU time used by the process's children which have died. You can set cumulative mode with the __S__ command line option or toggle it with the interactive command __S__. The header line will then be changed to __CTIME__. __%CPU__ The task's share of the CPU time since the last screen update, expressed as a percentage of total CPU time per processor. __%MEM__ The task's share of the physical memory. __COMMAND__ The task's command name, which will be truncated if it is too long to be displayed on one line. Tasks in memory will have a full command line, but swapped-out tasks will only have the name of the program in parentheses (for example, __A , WP__ these fields from the kmem top are not supported. !!INTERACTIVE COMMANDS Several single-key commands are recognized while __top__ is running. Some are disabled if the __s__ option has been given on the command line. __space__ Immediately updates the display. __^L__ Erases and redraws the screen. __h__ or __?__ Displays a help screen giving a brief summary of commands, and the status of secure and cumulative modes. __k__ Kill a process. You will be prompted for the PID of the task, and the signal to send to it. For a normal kill, send signal 15. For a sure, but rather abrupt, kill, send signal 9. The default signal, as with kill(1), is 15, __SIGTERM__. This command is not available in secure mode. __i__ Ignore idle and zombie processes. This is a toggle switch. __I__ Toggle between Solaris (CPU percentage divided by total number of CPUs) and Irix (CPU percentage calculated solely by amount of time) views. This is a toggle switch that affects only SMP systems. __n__ or __#__ Change the number of processes to show. You will be prompted to enter the number. This overrides automatic determination of the number of processes to show, which is based on window size measurement. If 0 is specified, then top will show as many processes as will fit on the screen; this is the default. __q__ Quit. __r__ Re-nice a process. You will be prompted for the PID of the task, and the value to nice it to. Entering a positve value will cause a process to be niced to negative values, and lose priority. If root is running __top__, a negative value can be entered, causing a process to get a higher than normal priority. The default renice value is 10. This command is not available in secure mode. __S__ This toggles cumulative mode, the equivalent of __ps -S__, i.e., that CPU times will include a process's defunct children. For some programs, such as compilers, which work by forking into many seperate tasks, normal mode will make them appear less demanding than they actually are. For others, however, such as shells and __init__, this behavior is correct. In any case, try cumulative mode for an alternative view of CPU use. __s__ Change the delay between updates. You will be prompted to enter the delay time, in seconds, between updates. Fractional values are recognized down to microseconds. Entering 0 causes continuous updates. The default value is 5 seconds. Note that low values cause nearly unreadably fast displays, and greatly raise the load. This command is not available in secure mode. __f__ or __F__ Add fields to display or remove fields from the display. See below for more information. __o__ or __O__ Change order of displayed fields. See below for more information. __l__ toggle display of load average and uptime information. __m__ toggle display of memory information. __t__ toggle display of processes and CPU states information. __c__ toggle display of command name or full command line. __N__ sort tasks by pid (''n''umerically). __A__ sort tasks by age (newest first). __P__ sort tasks by CPU usage (default). __M__ sort tasks by resident memory usage. __T__ sort tasks by time / cumulative time. __W__ Write current setup to ''~/.toprc''. This is the recommended way to write a top configuration file. !!The Field and Order Screens After pressing __f__, __F__, __o__ or __O__ you will be shown a screen specifying the field order on the top line and short descriptions of the field contents. The field order string uses the following syntax: If the letter in the filed string corresponding to a field is upper case, the field will be displayed. This is furthermore indicated by an asterisk in front of the field description. The order of the fields corresponds to the order of the letters in the string. From the field select screen you can toggle the display of a field by pressing the corresponding letter. From the order screen you may move a field to the left by pressing the corresponding upper case letter resp. to the right by pressing the lower case one. !!Configuration Files Top reads it's default configuration from two files, ''/etc/toprc'' and ''~/.toprc''. The global configuration file may be used to restrict the usage of top to the secure mode for non-priviledged users. If this is desired, the file should contain a 's' to specify secure mode and a digit d (2 ''W'' interactive command. The second line is more interesting (and important). It contains information on the other options. Most important, if you have saved a configuration in secure mode, you will not get an insecure top without removing the lower 's' from the second line of your ''~/.toprc''. A digit specifies the delay time between updates, a capital 'S' cumulative mode, a lower 'i' no-idle mode, a capital 'I' Irix view. As in interactive mode, a lower 'm', 'l', and 't' suppresses the display of memory, uptime resp. process and CPU state information. Currently changing the default sorting order (by CPU usage) is not supported. !!NOTES This __proc__-based __top__ works by reading the files in the __proc__ filesystem, mounted on ''/proc''. If ''/proc'' is not mounted, __top__ will not work. __%CPU__ shows the cputime/realtime percentage in the period of time between updates. For the first update, a short delay is used, and __top__ itself dominates the CPU usage. After that, __top__ will drop back, and a more reliable estimate of CPU usage is available. The __SIZE__ and __RSS fields don't count the page tables and the task_struct__ of a process; this is at least 12K of memory that is always resident. __SIZE__ is the virtual size of the process (code+data+stack). Keep in mind that a process must die for its time to be recorded on its parent by cumulative mode. Perhaps more useful behavior would be to follow each process upwards, adding time, but that would be more expensive, possibly prohibitively so. In any case, that would make __top__'s behavior incompatible with __ps__. !!FILES ''/etc/toprc'' The global configuration file. ''~/.toprc'' The personal configuration file. !!SEE ALSO ps(1), free(1), uptime(1), kill(1), renice(1). !!BUGS If the window is less than about 70x7, __top__ will not format information correctly. Many fields still have problems with ELF processes. the help screens are not yet optimized for windows with less than 25 lines !!AUTHOR __top__ was originally written by Roger Binns, based on Branko Lankester's __ Helmut Geyer The Please send bug reports to ----
17 pages link to
top(1)
:
Zombie
gtop(1)
MemoryThrashing
kill(1)
ps(1)
pstree(1)
skill(1)
snice(1)
tload(1)
uptime(1)
vmstat(8)
w(1)
w.procps(1)
phosphor(1)
Man1t
KernelSpace
ProcessUtilities
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.