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 25, 2025 .Dt TOP 1 .Os .Sh NAME @@ -235,7 +235,7 @@ .Dq all . Boolean flags are toggles. A second specification of any of these options will negate the first. -.Sh "INTERACTIVE MODE" +.Sh INTERACTIVE MODE When .Nm is running in @@ -255,9 +255,8 @@ seconds to elapse. If this is the case, the command will be processed and the display will be updated immediately thereafter -(reflecting any changes that the command may have specified). -This -happens even if the command was incorrect. +.Pq reflecting any changes that the command may have specified . +This happens even if the command was incorrect. If a key is pressed while .Nm is in the middle of updating the display, it will finish the update and @@ -269,65 +268,54 @@ .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 -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. -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 space +Update the display. +.It Ic / +Filter by command name. +Prompt for +.Ar string +or +.Ql Ic + +to show all processes. +.It Ic a +Toggle display of process titles. +.It Ic C +Toggle display of raw or weighted CPU percentage. +.It Ic d +Change the number of remaining displays to show before exit. +Prompt for new number. +.It Ic e +Display a list of system errors (if any) generated by the last command. +.It Ic H +Toggle display of threads. +.It Ic h No or Ic \&? +Display a summary of the commands (help screen) and version information. +.It Ic i No or Ic I +Toggle display of idle processes. +.It Ic J +Filter processes owned by a specific jail. +Prompt for jail name or +.Ql Ic + +for all processes belonging to all jails and the host. +This will also enable the display of JID. +.It Ic j +Toggle 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 -Change the priority -.Pq the Dq nice -of a list of processes. -This acts similarly to -.Xr renice 8 . -.It u -Display only processes owned by a specific set of usernames (prompt for -username). -If the username specified is simply -.Dq + -or -.Dq - , -then processes belonging to all users will be displayed. -Usernames can be added -to and removed from the set by prepending them with -.Dq + -and -.Dq - , -respectively. -.It o +.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 , @@ -336,41 +324,54 @@ 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 +.It Ic P +Toggle display of per-CPU statistics. +.It Ic p +Filter by exact process ID. +Prompt for +.Ar PID +or +.Ql Ic + +to 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 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 between thread ID and process ID. +.It Ic t +Toggle display of the .Nm process. -.It w -Toggle the display of swap usage. -.It z -Toggle the display of the system idle process. +.It Ic u +Filter by exact process owner username. +Prompt for +.Ar username +or +.Ql Ic - Ns +.No / Ns +.Ql Ic + +for all users. +Usernames can be added +to and removed from the set by prepending them with +.Ql + +and +.Ql - , +respectively. +.It Ic w +Toggle display of swap usage. +.It Ic z +Toggle display of the system idle process. .El .Sh "THE DISPLAY" The top few lines of the display show general information