top

List running processes on the system, in sorted order.
Periodically displays a list of processes on the system in sorted order. The default key for sorting is pid, but other keys can be used instead.

Syntax
       top [-a | -d | -e | -c mode]
           [-F | -f]
           [-h]
           [-i interval]
           [-k]
           [-L | -l samples]
           [-o key] [-O skey]
           [-p format] [-P legend]
           [-R | -r]
           [-S]
           [-s delay]
           [-T | -t]
           [-U user]
           [-u]
           [-W | -w]
           [-X | -x]
           [[-n] nprocs]

Options

Command line option specifications are processed from left to right. Options can be specified more than once. If conflicting options are specified, later specifications override earlier ones. This makes it viable to create a shell alias for top with preferred defaults specified, then override those preferred defaults as desired on the command line.

       -c mode
	      Set event counting mode to mode.  The supported modes are:

	      a	     Accumulative mode.	 Count events  cumulatively,  starting
		     at	 the  launch of top.  Calculate CPU usage and CPU time
		     since the launch of top.

	      d	     Delta mode.  Count events relative to the	previous  sam-
		     ple.  Calculate CPU usage since the previous sample.

	      e	     Absolute mode.  Count events using absolute counters.

	      n	     Non-event	mode (default).	 Calculate CPU usage since the
		     previous sample.


       -F     Do not calculate statistics on shared libraries, also  known  as
	      frameworks.   This substantially reduces the amount of processor
	      time top consumes.

       -f     Calculate statistics on shared libraries, also known  as	frame-
	      works (default).

       -h     Print command line usage information and exit.

       -i interval
Update framework (-f) info every interval samples -L Use interactive (non-logging) mode. If not running on a termi- nal, exit with an error rather than running in logging mode. -l samples Use logging mode and display samples samples, even if standard output is a terminal. 0 is treated as infinity. Rather than redisplaying, output is periodically printed in raw form. -n nprocs Only display up to nprocs processes. nprocs can be speci- fied as the last command line argument without the -n flag pre- ceding it. However, doing so is deprecated command line usage. -O skey Use skey as a secondary key when ordering the process display. See -o for key names (pid is default). -o key Order the process display by sorting on key in descending or- der. A + or - can be prefixed to the key name to specify as- cending or descending order, respectively. The supported keys are: cpu CPU usage. pid Process ID (default). prt Number of Mach ports. reg Number of memory regions. rprvt Resident private address space size. rshrd Resident shared address space size. rsize Resident memory size. th Number of threads. time Execution time. uid User ID. username Username. vprvt Private address space size. vsize Total memory size. -P legend Set a custom legend string (containing the column headings); this should usually be used with a custom format string. -p format Set a custom format string to display process info. -R Do not traverse and report the memory object map for each process. This substantially reduces the amount of processor time top consumes. -r Traverse and report the memory object map for each process (de- fault). -S Display information about swap usage and purgeable memory. -s delay Set the delay between updates to delay seconds. The default delay between updates is 1 second. -T Do not translate uid numbers to usernames (default). -t Translate uid numbers to usernames. -U user Only display processes owned by user. Either the username or uid number can be specified. -W Display + or - to indicate deltas (default). -w Display delta values, rather than just + or -. -X Run in legacy/compatibility mode. -x Run using the nominal display format. Deprecated_Options -a Equivalent to -ca. -d Equivalent to -cd. -e Equivalent to -ce. -k Deprecated (does nothing) -u Equivalent to -ocpu -Otime. Interactive (non-logging) mode ? Help ^L Redraw ca Set accumulative mode cd Set delta mode ce Set event mode cn Set non-event mode f Toggle shared library statistics reporting. n nprocs Only display up to nprocs processes. 0 = infinity. O skey Use skey as a secondary key when ordering the process display. See the o command for key names. o key Order the process display by sorting on key in descending order. A + or - can be prefixed to the key name to specify ascending or descending order, respectively. The supported keys are: command Command name. cpu CPU usage. pid Process ID. prt Number of Mach ports. reg Number of memory regions. rprvt Resident private address space size. rshrd Resident shared address space size. rsize Resident memory size. th Number of threads. time Execution time. uid User ID. username Username. vprvt Private address space size. vsize Total memory size. q Quit. r Toggle traversal and reporting of the memory object map for each process. S signal pid Send sig to pid. sig can be specified either as a number or as a name (for example, HUP). The default signal starts out as TERM. Each time a signal is successfully sent, the default signal is updated to be that signal. pid is a process id. s delay Set the delay between updates to delay seconds. t Toggle translation of uid numbers to usernames. U user Only display processes owned by user. Either the username or uid number can be specified. To display all processes, press enter without entering a username or uid number. w Toggle wide/narrow delta mode. x Toggle display formats. Examples Display processes sorted by CPU usage, updating every 5 seconds: $ top -ocpu -s 5 Run top in event counter mode: $ top -ce Translate uid numbers to usernames and run in logging mode, taking 10 samples at 2 second intervals: $ top -tl 10

“Venice is like eating an entire box of chocolate liqueurs at one go” - Truman Capote

Related:

top man page - Apple.com
kill - Stop a process from running
signal(3) - software signal facilities



Back to the Top

© Copyright SS64.com 1999-2012
Some rights reserved