.\" Copyright (c) 1985, 1990, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" @(#)systat.1 8.2 (Berkeley) 12/30/93 .\" $FreeBSD: src/usr.bin/systat/systat.1,v 1.23.2.9 2002/12/29 16:35:40 schweikh Exp $ .\" .Dd October 19, 2023 .Dt SYSTAT 1 .Os .Sh NAME .Nm systat .Nd display system statistics on a crt .Sh SYNOPSIS .Nm .Op Fl w .Op Fl h .Op Fl Ar display .Op Ar refresh-interval .Sh DESCRIPTION The .Nm utility displays various system statistics in a screen oriented fashion using the curses screen display library, .Xr ncurses 3 . .Pp While .Nm is running the screen is usually divided into two windows (an exception is the .Ic vmstat and .Ic pvmmeter displays which uses the entire screen). The upper window depicts the current system load average. The information displayed in the lower window may vary, depending on user commands. The last line on the screen is reserved for user input and error messages. .Pp By default .Nm displays the processes getting the largest percentage of the processor in the lower window. Other displays show swap space usage, disk .Tn I/O statistics (a la .Xr iostat 8 ) , virtual memory statistics (a la .Xr vmstat 8 ) , network ``mbuf'' utilization, .Tn TCP/IP statistics, and network connections (a la .Xr netstat 1 ) . .Pp Input is interpreted at two different levels. A ``global'' command interpreter processes all keyboard input. If this command interpreter fails to recognize a command, the input line is passed to a per-display command interpreter. This allows each display to have certain display-specific commands. .Pp Command line options: .Bl -tag -width "refresh_interval" .It Fl w Wide mode output if available. .It Fl h Print help and exit. .It Fl Ns Ar display The .Fl flag expects .Ar display to be one of: .Ic altqs , .Ic icmp , .Ic icmp6 , .Ic ifstat , .Ic iostat , .Ic ip , .Ic ip6 , .Ic mbufs , .Ic netbw , .Ic netstat , .Ic pftop , .Ic pigs , .Ic pvmmeter , .Ic sensors , .Ic swap , .Ic tcp , or .Ic vmstat . These displays can also be requested interactively (without the .Sq Fl ) and are described in full detail below. .It Ar refresh-interval The .Ar refresh-interval specifies the screen refresh time interval in seconds. Default is 5 seconds. .El .Pp Certain characters cause immediate action by .Nm . These are .Bl -tag -width Fl .It Ic \&^L Refresh the screen. .It Ic \&^G Print the name of the current ``display'' being shown in the lower window and the refresh interval. .It Ic \&: Move the cursor to the command line and interpret the input line typed as a command. While entering a command the current character erase, word erase, and line kill characters may be used. .El .Pp The following commands are interpreted by the ``global'' command interpreter. .Bl -tag -width Fl .It Ic help Print the names of the available displays on the command line. .It Ic load Print the load average over the past 1, 5, and 15 minutes on the command line. .It Ic stop Stop refreshing the screen. .It Oo Ic start Oc Op Ar number Start (continue) refreshing the screen. If a second, numeric, argument is provided it is interpreted as a refresh interval (in seconds). Supplying only a number will set the refresh interval to this value. .It Ic quit Exit .Nm . (This may be abbreviated to .Ic q . ) .El .Pp The available displays are: .Bl -tag -width Ic .It Ic pigs Display, in the lower window, those processes resident in main memory and getting the largest portion of the processor (the default display). When less than 100% of the processor is scheduled to user processes, the remaining time is accounted to the ``idle'' process. .It Ic icmp Display, in the lower window, statistics about messages received and transmitted by the Internet Control Message Protocol .Pq Dq Tn ICMP . The left half of the screen displays information about received packets, and the right half displays information regarding transmitted packets. .Pp The .Ic icmp display understands two commands: .Ic mode and .Ic reset . The .Ic mode command is used to select one of four display modes, given as its argument: .Pp .Bl -tag -width absoluteXX -compact .It Ic rate Show the rate of change of each value in packets per second (the default). .It Ic delta Show the rate of change of each value in packets per refresh interval. .It Ic since Show the total change of each value since the display was last reset. .It Ic absolute Show the absolute value of each statistic. .El .Pp The .Ic reset command resets the baseline for .Ic since mode. The .Ic mode command with no argument will display the current mode in the command line. .It Ic icmp6 This display is like the .Ic icmp display, but displays statistics for .Tn IPv6 ICMP . .It Ic ip Otherwise identical to the .Ic icmp display, except that it displays .Tn IP and .Tn UDP statistics. .It Ic ip6 Like the .Ic ip display, except that it displays .Tn IPv6 statistics. .It Ic tcp Like .Ic icmp , but with .Tn TCP statistics. .It Ic ifstat Display, in the lower window, statistics about network throughput on a per-interface basis. .It Ic iostat Display, in the lower window, statistics about processor use and disk throughput. Statistics on processor use appear as bar graphs of the amount of time executing in user mode (`user'), in user mode running low priority processes (`nice'), in system mode (`system'), in interrupt mode (`interrupt'), and idle (`idle'). Statistics on disk throughput show, for each drive, megabytes per second, average number of disk transactions per second, and average kilobytes of data per transaction. This information may be displayed as bar graphs or as rows of numbers which scroll downward. Bar graphs are shown by default. .Pp The following commands are specific to the .Ic iostat display; the minimum unambiguous prefix may be supplied. .Pp .Bl -tag -width Fl -compact .It Ic numbers Show the disk .Tn I/O statistics in numeric form. Values are displayed in numeric columns which scroll downward. .It Ic bars Show the disk .Tn I/O statistics in bar graph form (default). .It Ic kbpt Toggle the display of kilobytes per transaction. (the default is to not display kilobytes per transaction). .El .It Ic sensors Display, in the lower window, the current values of available hardware sensors, in a format similar to that of .Xr sysctl 8 . .Pp The following commands are specific to the .Ic sensors display; the minimum unambiguous prefix may be supplied. .Pp .Bl -tag -width Fl -compact .It Ic type Op Ar type ... Display only the sensors which match the specified .Ar type . Multiple types may be specified, separated by spaces. If no types are specified, all available sensors will be displayed. Supported values of .Ar type are .Cm temp , .Cm fan , .Cm volt , .Cm acvolt , .Cm resistance , .Cm power , .Cm current , .Cm watthour , .Cm amphour , .Cm indicator , .Cm raw , .Cm percent , .Cm illuminance , .Cm drive , .Cm timedelta , and .Cm ecc . .It Ic match Op Ar device ... Display only the sensors match the specified .Ar device . Multiple devices may be specified, separated by spaces. If no devices are specified, all available sensors will be displayed. A device type could be specified by using an asterisk .Pq Sq Li * in the place of the device unit. For example: .Pp .Dl match cpu* .El .It Ic swap Show information about swap space usage on all the swap areas compiled into the kernel. The first column is the device name of the partition. The next column is the total space available in the partition. The `Used' column indicates the total blocks used so far; the graph shows the percentage of space in use on each partition. If there are more than one swap partition in use, a total line is also shown. Areas known to the kernel, but not in use are shown as not available. .It Ic mbufs Display, in the lower window, the number of mbufs allocated for particular uses, i.e.\& data, socket structures, etc. .It Ic vmstat Take over the entire display and show a (rather crowded) compendium of statistics related to virtual memory usage, process scheduling, device interrupts, system name translation cacheing, disk .Tn I/O etc. .Pp The upper left quadrant of the screen shows the number of users logged in and the load average over the last one, five, and fifteen minute intervals. .Pp Below this line are statistics on memory utilization. The first row (`Active') reports memory usage in bytes only among active processes, that is processes that have run in the previous twenty seconds. The second row (`Kernel') reports memory usage in bytes by the kernel. The third row (`Free .. i+c+f') shows freeable memory in bytes, which is inactive + cache + free. I.e.\& Free i+c+f includes inactive pages, which aren't quite free, but they will be made free given enough memory pressure. Finally the last row (`Total') shows total system memory in bytes. The second column reports on memory usage of all processes. The first row (`VM-rss') shows bytes for total RSS. This is basically how many pages the system is mapping to user processes. Due to sharing this can be a large value. The second row (`VM-swp') reports on swap, first swap used in bytes, then, after `/', total swap in bytes. .Pp Below the memory display is a list of the average number of processes (over the last refresh interval) that are runnable (`r'), in page wait (`p'), in disk wait other than paging (`d'), sleeping (`s'), and swapped out but desiring to run (`w'). The row also shows the average number of context switches (`Csw'), traps (`Trp'; includes page faults), system calls (`Sys'), interrupts (`Int'), network software interrupts (`Sof'), and page faults (`Flt'). .Pp Below the process queue length listing is a listing of .Tn CPU usage, a numerical listing and a bar graph showing the amount of system (`='), interrupt (`+'), user (`>'), nice (`-'), and idle time (` '). .Pp Below the .Tn CPU usage display are statistics on name translations and execs. It lists the number of path names translated in the previous interval (`Path-lookups'), the number and percentage of the path lookups that were handled by the name translation cache, the average number of path components in path lookups (`Components') and, the number of execs .Xr ( execve 2 ) per second (`Execs'). .Pp At the bottom left is the disk usage display. It reports the number of kilobytes per transaction (`KB/t'), read transactions per second (`tpr/s'), megabytes per second in read transaction (`MBr/s'), write transactions per second (`tpw/s'), megabytes per second in write transaction (`MBw/s') and the percentage of the time the disk was busy (`% busy') averaged over the refresh period of the display (by default, five seconds). The system keeps statistics on most every storage device. In general, up to seven devices are displayed. The devices displayed by default are the first devices in the kernel's device list. Some devices are not shown by default, see .Ic ignore command below. See .Xr devstat 3 and .Xr devstat 9 for details on the devstat system. .Pp If at most 4 disk devices are shown, extended virtual memory statistics are shown right to disk usage: pages non-optimized zero filled on demand (`nzfod'), pages optimized zero filled on demand (`ozfod'), slow (i.e.\& non-optimized) zero fills percentage (`%sloz'), total pages freed (`tfree'). .Pp Under the date in the upper right hand quadrant are statistics on paging and swapping activity. The first two columns (`VN PAGER') report the average number of bytes brought in and out per second over the last refresh interval due to page faults and the paging daemon. The third and fourth columns (`SWAP PAGER') report the average number of bytes brought in and out per second over the last refresh interval due to swap requests initiated by the scheduler. The first row (`bytes') of the display shows the average number of bytes transferred per second over the last refresh interval; the second row (`count') of the display shows the average number of disk transfers per second over the last refresh interval; this usually matches number of pages transferred per second over the last refresh interval. .Pp Below the paging statistics is a column of lines regarding the virtual memory system which list the average number of bytes in pages zero filled on demand (`zfod') (shown with extended virtual memory statistics if screen space permits), bytes in pages copied on write (`cow'), bytes in pages wired down (`wire'), bytes in active pages (`act'), bytes in inactive pages (`inact'), bytes in pages on the buffer cache queue (`cache'), bytes in free pages (`free'), pages freed by the page daemon (`daefr'), pages freed by exiting processes (`prcfr'), pages reactivated from the free list (`react'), times the page daemon was awakened (`pdwak'), pages analyzed by the page daemon (`pdpgs'), and intransit blocking page faults (`intrn') per second over the refresh interval. .Pp At the bottom of this column are lines showing the amount of memory, in bytes, used for the buffer cache (`buf'), number of dirty buffers in the buffer cache (`dirtybuf'), number of active vnodes (`activ-vp'), number of cached vnodes (`cachd-vp'), and number of inactive vnodes (`inact-vp'). .Pp Running down the right hand side of the display is a breakdown of the interrupts being handled by the system (`Interrupts'). At the top of the list is the total interrupts per second over the time interval (`total'). The rest of the column breaks down the total on a device by device basis. Only devices that have interrupted at least once since boot time are shown. .Pp The following commands are specific to the .Ic vmstat display; the minimum unambiguous prefix may be supplied. .Pp .Bl -tag -width Ar -compact .It Ic boot Display cumulative statistics since the system was booted. .It Ic run Display statistics as a running total from the point this command is given. .It Ic time Display statistics averaged over the refresh interval (the default). .It Ic zero Reset running statistics to zero. .El .It Ic pvmmeter Display total and per .Tn CPU statistics, including .Tn LAPIC timer interrupts (`timer'), .Tn IPIs (Inter-Processor Interrupts) (`ipi'), external interrupts (i.e.\& not timer or ipi) (`extint'), .Tn CPU time breakdown (`user%', `sys%', `intr%', and `idle%'), .Tn SMP collisions (`smpcol'), and name of last colliding item (`label'). Item can be .Xr token 9 , .Xr lockmgr 9 , .Xr mutex 9 , or .Xr spinlock 9 . .It Ic netstat Display, in the lower window, network connections. By default, network servers awaiting requests are not displayed. Each address is displayed in the format ``host.port'', with each shown symbolically, when possible. It is possible to have addresses displayed numerically, limit the display to a set of ports, hosts, and/or protocols (the minimum unambiguous prefix may be supplied): .Pp .Bl -tag -width Ar -compact .It Ic all Toggle the displaying of server processes awaiting requests (this is the equivalent of the .Fl a flag to .Xr netstat 1 ) . .It Ic numbers Display network addresses numerically. .It Ic names Display network addresses symbolically. .It Ic proto Ar protocol Display only network connections using the indicated .Ar protocol . Supported protocols are .Cm tcp , .Cm udp , and .Cm all . .It Ic ignore Op Ar items Do not display information about connections associated with the specified hosts or ports. Hosts and ports may be specified by name (``vangogh'', ``ftp''), or numerically. Host addresses use the Internet dot notation (``128.32.0.9''). Multiple items may be specified with a single command by separating them with spaces. .It Ic display Op Ar items Display information about the connections associated with the specified hosts or ports. As for .Ic ignore , .Ar items may be names or numbers. .It Ic show Op Cm ports | protos | hosts Show, on the command line, the currently selected protocols, hosts, and ports. Hosts and ports which are being ignored are prefixed with a `!'. If .Cm ports or .Cm hosts is supplied as an argument to .Ic show , then only the requested information will be displayed. .It Ic reset Reset the port, host, and protocol matching mechanisms to the default (any protocol, port, or host). .El .It Ic netbw Display aggregate and per-connection TCP receive and transmit rates. Only active TCP connections originated or terminated by the host are shown. .It Ic pftop Display packet filter .Pq Xr pf 4 state information for states which are actively passing data. This requires .Xr pf 4 to be active to be meaningful but is capable of displaying connection state for all packet traffic passing through the machine, even for connections that do not originate or terminate on the machine. .Pp You need a wide ~100 column window to display .Ic pftop reasonably well. IPV6 addresses are truncated (just the first two and last two words are displayed) for brevity. Generally speaking `rcv' is data received by the first IP address and `snd' is data sent to the second IP address. `ttl' is the total sum of data sent plus received tracked by the state. .Pp The display is sorted by average rx+tx bandwidth calculated on a 1/8 decay curve to prevent fields from jumping around too much. Units for all rows are selected based on the largest bandwidth measurement for uniformity. Note that two states will be present for any connection operating over NAT. Needs root privilege. .It Ic altqs Display packet filter altq statistics. The ALTQ operates in conjunction with the packet filter (pf) on the interface's transmit path. Packet rate, data rate in bytes per interval, drop rate, and queue length is displayed in three separate sections in a convenient INTERFACE-by-ALTQLABEL matrix. .Pp To save space drops and queue length are combined in the third section. If packet drops are present, drops will be displayed, otherwise the packet queue length with a .Ql Q suffix will be displayed. .El .Pp Commands to switch between displays may be abbreviated to the minimum unambiguous prefix; for example, ``io'' for ``iostat''. Certain information may be discarded when the screen size is insufficient for display. For example, on a machine with 10 drives the .Ic iostat bar graph displays only 3 drives on a 24 line terminal. When a bar graph would overflow the allotted screen space it is truncated and the actual value is printed ``over top'' of the bar. .Pp The following commands are common to each display which shows information about disk drives. These commands are used to select a set of drives to report on, should your system have more drives configured than can normally be displayed on the screen. .Pp .Bl -tag -width Ar -compact .It Ic ignore Op Ar drives Do not display information about the drives indicated. Multiple drives may be specified, separated by spaces. .Pp By default .Xr md 4 , .Xr pass 4 , and .Xr sg 4 devices are .Ic ignore Ns d . This is to save space for other devices which are usually more interesting. .It Ic display Op Ar drives Display information about the drives indicated. Multiple drives may be specified, separated by spaces. .It Ic only Op Ar drives Display only the specified drives. Multiple drives may be specified, separated by spaces. .It Ic drives Display a list of available devices. .It Ic match Ar type , Ns Ar if , Ns Ar pass Op | Ar ... Display devices matching the given pattern. The basic matching expressions are the same as those used in .Xr iostat 8 with one difference. Instead of specifying multiple .Fl t arguments which are then ORed together, the user instead specifies multiple matching expressions joined by the pipe .Pq Ql \&| character. The comma separated arguments within each matching expression are ANDed together, and then the pipe separated matching expressions are ORed together. Any device matching the combined expression will be displayed, if there is room to display it. For example: .Pp .Dl match da,scsi | cd,ide .Pp This will display all .Tn SCSI Direct Access devices and all .Tn IDE CDROM devices. .Pp .Dl match da | sa | cd,pass .Pp This will display all Direct Access devices, all Sequential Access devices, and all passthrough devices that provide access to .Tn CDROM drives. .El .Sh FILES .Bl -tag -width ".Pa /boot/kernel/kernel" -compact .It Pa /boot/kernel/kernel For the namelist .It Pa /dev/kmem For information in main memory .It Pa /etc/hosts For host names .It Pa /etc/networks For network names .It Pa /etc/services For port names .El .Sh SEE ALSO .Xr netstat 1 , .Xr devstat 3 , .Xr kvm 3 , .Xr icmp 4 , .Xr icmp6 4 , .Xr ip 4 , .Xr ip6 4 , .Xr pf 4 , .Xr tcp 4 , .Xr udp 4 , .Xr iostat 8 , .Xr sysctl 8 , .Xr vmstat 8 , .Xr devstat 9 , .Xr lockmgr 9 , .Xr mutex 9 , .Xr spinlock 9 , .Xr token 9 .Sh HISTORY The .Nm program appeared in .Bx 4.3 . The .Ic icmp , .Ic ip , and .Ic tcp displays appeared in .Fx 3.0 ; the notion of having different display modes for the .Tn ICMP , .Tn IP , .Tn TCP , and .Tn UDP statistics was stolen from the .Fl C option to .Xr netstat 1 in Silicon Graphics' .Tn IRIX system. .Sh BUGS Certain displays presume a minimum of 80 characters per line. The .Ic vmstat display looks out of place because it is (it was added in as a separate display rather than created as a new program).