diff --git a/usr.bin/top/commands.c b/usr.bin/top/commands.c --- a/usr.bin/top/commands.c +++ b/usr.bin/top/commands.c @@ -51,35 +51,35 @@ const struct command all_commands[] = { - {'C', "toggle the displaying of weighted CPU percentage", false, CMD_wcputog}, + {' ', "update the display", false, CMD_update}, + {'/', "filter on command name (+ selects all commands)", false, CMD_grep}, + {'a', "toggle the display of process titles", false, CMD_showargs}, + {'C', "toggle the display of raw or weighted CPU percentage", false, CMD_wcputog}, {'d', "change number of displays to show", false, CMD_displays}, {'e', "list errors generated by last \"kill\" or \"renice\" command", false, CMD_errors}, - {'H', "toggle the displaying of threads", false, CMD_thrtog}, + {'H', "toggle the display of threads", false, CMD_thrtog}, {'h', "show this help text", true, CMD_help}, {'?', NULL, true, CMD_help}, - {'/', "filter on command name (+ selects all commands)", false, CMD_grep}, - {'i', "toggle the displaying of idle processes", false, CMD_idletog}, + {'i', "toggle the display of idle processes", false, CMD_idletog}, {'I', NULL, false, CMD_idletog}, - {'j', "toggle the displaying of jail ID", false, CMD_jidtog}, {'J', "display processes for only one jail (+ selects all jails)", false, CMD_jail}, + {'j', "toggle the display of jail ID", false, CMD_jidtog}, {'k', "kill processes; send a signal to a list of processes", false, CMD_kill}, - {'q', "quit" , true, CMD_quit}, {'m', "toggle the display between 'cpu' and 'io' modes", false, CMD_viewtog}, {'n', "change number of processes to display", false, CMD_number}, {'#', NULL, false, CMD_number}, {'o', "specify the sort order", false, CMD_order}, + {'P', "toggle the display of per-CPU statistics", false, CMD_pcputog}, {'p', "display one process (+ selects all processes)", false, CMD_pid}, - {'P', "toggle the displaying of per-CPU statistics", false, CMD_pcputog}, + {'q', "quit" , true, CMD_quit}, {'r', "renice a process", false, CMD_renice}, + {'S', "toggle the display of system processes", false, CMD_viewsys}, {'s', "change number of seconds to delay between updates", false, CMD_delay}, - {'S', "toggle the displaying of system processes", false, CMD_viewsys}, - {'a', "toggle the displaying of process titles", false, CMD_showargs}, - {'T', "toggle the displaying of thread IDs", false, CMD_toggletid}, + {'T', "toggle the display of thread IDs", false, CMD_toggletid}, {'t', "toggle the display of this process", false, CMD_selftog}, {'u', "display processes for only one user (+ selects all users)", false, CMD_user}, {'w', "toggle the display of swap use for each process", false, CMD_swaptog}, - {'z', "toggle the displaying of the system idle process", false, CMD_kidletog}, - {' ', "update the display", false, CMD_update}, + {'z', "toggle the display of the system idle process", false, CMD_kidletog}, {0, NULL, true, CMD_NONE} }; @@ -108,7 +108,7 @@ } else if (curcmd->c == ' '){ /* special case space rather than introducing a "display string" to * the struct */ - sprintf(keys, "SPC"); + sprintf(keys, "space"); } else { sprintf(keys, "%c", curcmd->c); } diff --git a/usr.bin/top/top.1 b/usr.bin/top/top.1 --- a/usr.bin/top/top.1 +++ b/usr.bin/top/top.1 @@ -1,4 +1,4 @@ -.Dd November 18, 2021 +.Dd March 22, 2025 .Dt TOP 1 .Os .Sh NAME @@ -6,7 +6,7 @@ .Nd display and update information about the top cpu processes .Sh SYNOPSIS .Nm -.Op Fl abCHIijnPpqSTtuvxz +.Op Fl abCHIijnPpqSTtuvwz .Op Fl d Ar count .Op Fl J Ar jail .Op Fl m Ar mode @@ -48,7 +48,7 @@ terminal. .Pp The options are as follows: -.Bl -tag -width indent +.Bl -tag -width "-U username" .It Fl a Display command names derived from the argv[] vector, rather than real executable name. @@ -269,51 +269,93 @@ .Xr stty 1 ) are recognized, and a newline terminates the input. .Pp -These commands are currently recognized (^L refers to control-L): +The bindings are as follows: .Bl -tag -width indent -.It ^L -Redraw the screen. -.It h -Display a summary of the commands (help screen). -Version information -is included in this display. -.It q -Quit -.Nm -.It d +.It Ic space +Update the screen. +.It Ic / +Display only processes that contain the specified string in their +command name. +.It Ic a +Toggle the display of process titles. +.It Ic C +Toggle the display of raw or weighted CPU percentage. +.It Ic d Change the number of displays to show (prompt for new number). Remember that the next display counts as one, so typing 'd1' will make .Nm show one final display and then immediately exit. -.It / -Display only processes that contain the specified string in their -command name. +.It Ic e +Display a list of system errors (if any) generated by the last +command. +.It Ic H +Toggle the display of threads. +.It Ic h No or Ic \&? +Display a summary of the commands (help screen). +Version information +is included in this display. If displaying arguments is enabled, the arguments are searched too. '+' shows all processes. -.It m -Toggle the display between 'cpu' and 'io' modes. -.It n or # -Change the number of processes to display (prompt for new number). -.It s -Change the number of seconds to delay between displays -(prompt for new number). -.It S -Toggle the display of system processes. -.It a -Toggle the display of process titles. -.It k +.It Ic i No or Ic I +Toggle the display of idle processes. +.It Ic J +Display only processes owned by a specific jail (prompt for jail). +If the jail specified is simply +.Dq + , +then processes belonging +to all jails and the host will be displayed. +This will also enable the display of JID. +.It Ic j +Toggle the display of +.Xr jail 8 +ID. +.It Ic k Send a signal .Pq SIGKILL by default to a list of processes. This acts similarly to the command .Xr kill 1 . -.It r +.It Ic m +Toggle the display between 'cpu' and 'io' modes. +.It Ic n No or Ic # +Change the number of processes to display (prompt for new number). +.It Ic o +Change the order in which the display is sorted. +The sort key names include +.Dq cpu , +.Dq res , +.Dq size , +and +.Dq time. +The default is cpu. +.It Ic P +Toggle the display of per-CPU statistics. +.It Ic p +Display a specific process (prompt for pid). +If the pid specified is simply +.Dq + , +then show all processes. +.It Ic q +Quit +.Nm . +.It Ic r Change the priority .Pq the Dq nice of a list of processes. This acts similarly to .Xr renice 8 . -.It u +.It Ic S +Toggle the display of system processes. +.It Ic s +Change the number of seconds to delay between displays +(prompt for new number). +.It Ic T +Toggle display of TID and PID +.It Ic t +Toggle the display of the +.Nm +process. +.It Ic u Display only processes owned by a specific set of usernames (prompt for username). If the username specified is simply @@ -327,52 +369,12 @@ and .Dq - , respectively. -.It o -Change the order in which the display is sorted. -The sort key names include -.Dq cpu , -.Dq res , -.Dq size , -and -.Dq time. -The default is cpu. -.It p -Display a specific process (prompt for pid). -If the pid specified is simply -.Dq + , -then show all processes. -.It e -Display a list of system errors (if any) generated by the last -command. -.It H -Toggle the display of threads. -.It i or I -Toggle the display of idle processes. -.It j -Toggle the display of -.Xr jail 8 -ID. -.It J -Display only processes owned by a specific jail (prompt for jail). -If the jail specified is simply -.Dq + , -then processes belonging -to all jails and the host will be displayed. -This will also enable the display of JID. -.It P -Toggle the display of per-CPU statistics. -.It T -Toggle display of TID and PID -.It t -Toggle the display of the -.Nm -process. -.It w +.It Ic w Toggle the display of swap usage. -.It z +.It Ic z Toggle the display of the system idle process. .El -.Sh "THE DISPLAY" +.Sh THE DISPLAY The top few lines of the display show general information about the state of the system, including the last process id assigned to a process (on most systems),