[root@localhost Linux_Test]# head --help 用法:head [选项]... [文件]... Print the first 10 lines of each FILE to standard output. With more than one FILE, precede each with a header giving the file name. With no FILE, or when FILE is -, read standard input.
Mandatory arguments to long options are mandatory for short options too. -c, --bytes=[-]K print the first K bytes of each file; with the leading '-', print all but the last K bytes of each file -n, --lines=[-]K print the first K lines instead of the first 10; with the leading '-', print all but the last K lines of each file -q, --quiet, --silent 不显示包含给定文件名的文件头 -v, --verbose 总是显示包含给定文件名的文件头 --help 显示此帮助信息并退出 --version 显示版本信息并退出
K 后面可以跟乘号: b 512, kB 1000, K 1024, MB 1000*1000, M 1024*1024, GB 1000*1000*1000, G 1024*1024*1024, 对于T, P, E, Z, Y 同样适用。
If first and second call formats both apply, the second format is assumed if the last operand begins with + or (if there are 2 operands) a digit. An OFFSET operand means -j OFFSET. LABEL is the pseudo-address at first byte printed, incremented when dump is progressing. For OFFSET and LABEL, a 0x or 0X prefix indicates hexadecimal; suffixes may be . for octal and b for multiply by 512.
Mandatory arguments to long options are mandatory for short options too. -A, --address-radix=RADIX output format for file offsets; RADIX is one of [doxn], for Decimal, Octal, Hex or None -j, --skip-bytes=BYTES skip BYTES input bytes first -N, --read-bytes=BYTES limit dump to BYTES input bytes -S BYTES, --strings[=BYTES] output strings of at least BYTES graphic chars; 3 is implied when BYTES is not specified -t, --format=TYPE select output format or formats -v, --output-duplicates do not use * to mark line suppression -w[BYTES], --width[=BYTES] output BYTES bytes per output line; 32 is implied when BYTES is not specified --traditional accept arguments in third form above --help 显示此帮助信息并退出 --version 显示版本信息并退出
Traditional format specifications may be intermixed; they accumulate: -a same as -t a, select named characters, ignoring high-order bit -b same as -t o1, select octal bytes -c same as -t c, select printable characters or backslash escapes -d same as -t u2, select unsigned decimal 2-byte units -f 即 -t fF,指定浮点数对照输出格式 -i 即 -t dl,指定十进制整数对照输出格式 -l 即 -t dL,指定十进制长整数对照输出格式 -o 即 -t o2,指定双字节单位八进制数的对照输出格式 -s 即 -t d2,指定双字节单位十进制数的对照输出格式 -x 即 -t x2,指定双字节单位十六进制数的对照输出格式
TYPE is made up of one or more of these specifications: a named character, ignoring high-order bit c printable character or backslash escape d[尺寸] 有符号十进制数,每个整形数占指定尺寸的字节 f[尺寸] 浮点数,每个整形数占指定尺寸的字节 o[尺寸] 八进制数,每个整形数占指定尺寸的字节 u[尺寸] 无符号十进制数,每个整形数占指定尺寸的字节 x[尺寸] 十六进制数,每个整形数占指定尺寸的字节
SIZE is a number. For TYPE in [doux], SIZE may also be C for sizeof(char), S for sizeof(short), I for sizeof(int) or L for sizeof(long). If TYPE is f, SIZE may also be F for sizeof(float), D for sizeof(double) or L for sizeof(long double).
Adding a z suffix to any type displays printable characters at the end of each output line.
BYTES is hex with 0x or 0X prefix, and may have a multiplier suffix: b 512 KB 1000 K 1024 MB 1000*1000 M 1024*1024 and so on for G, T, P, E, Z, Y.
================================================================================================================================================ Package 架构 版本 源 大小 ================================================================================================================================================ 正在安装: libX11-devel aarch64 1.6.7-3.el7_9 updates 981 k libXmu-devel aarch64 1.1.2-2.el7 base 24 k 为依赖而安装: libICE aarch64 1.0.9-9.el7 base 63 k libICE-devel aarch64 1.0.9-9.el7 base 50 k libSM aarch64 1.2.2-2.el7 base 38 k libSM-devel aarch64 1.2.2-2.el7 base 12 k libX11 aarch64 1.6.7-3.el7_9 updates 582 k libX11-common noarch 1.6.7-3.el7_9 updates 164 k libXau aarch64 1.0.8-2.1.el7 base 29 k libXau-devel aarch64 1.0.8-2.1.el7 base 14 k libXext aarch64 1.3.3-3.el7 base 37 k libXext-devel aarch64 1.3.3-3.el7 base 74 k libXmu aarch64 1.1.2-2.el7 base 68 k libXt aarch64 1.1.5-3.el7 base 157 k libXt-devel aarch64 1.1.5-3.el7 base 445 k libxcb aarch64 1.13-1.el7 base 210 k libxcb-devel aarch64 1.13-1.el7 base 1.1 M xorg-x11-proto-devel noarch 2018.4-1.el7 base 280 k
Commands marked with * may be preceded by a number, N. Notes in parentheses indicate the behavior if N is given. A key preceded by a caret indicates the Ctrl key; thus ^K is ctrl-K.
h H Display this help. q :q Q :Q ZZ Exit. ---------------------------------------------------------------------------
MOVING
e ^E j ^N CR * Forward one line (or N lines). y ^Y k ^K ^P * Backward one line (or N lines). f ^F ^V SPACE * Forward one window (or N lines). b ^B ESC-v * Backward one window (or N lines). z * Forward one window (and set window to N). w * Backward one window (and set window to N). ESC-SPACE * Forward one window, but don't stop at end-of-file. d ^D * Forward one half-window (and set half-window to N). u ^U * Backward one half-window (and set half-window to N). ESC-) RightArrow * Left one half screen width (or N positions). ESC-( LeftArrow * Right one half screen width (or N positions). F Forward forever; like "tail -f". r ^R ^L Repaint screen. R Repaint screen, discarding buffered input. --------------------------------------------------- Default "window" is the screen height. Default "half-window" is half of the screen height. ---------------------------------------------------------------------------
SEARCHING
/pattern * Search forward for (N-th) matching line. ?pattern * Search backward for (N-th) matching line. n * Repeat previous search (for N-th occurrence). N * Repeat previous search in reverse direction. ESC-n * Repeat previous search, spanning files. ESC-N * Repeat previous search, reverse dir. & spanning files. ESC-u Undo (toggle) search highlighting. &pattern * Display only matching lines --------------------------------------------------- A search pattern may be preceded by one or more of: ^N or ! Search for NON-matching lines. ^E or * Search multiple files (pass thru END OF FILE). ^F or @ Start search at FIRST file (for /) or last file (for ?). ^K Highlight matches, but don't move (KEEP position). ^R Don't use REGULAR EXPRESSIONS. ---------------------------------------------------------------------------
JUMPING
g < ESC-< * Go to first line in file (or line N). G > ESC-> * Go to last line in file (or line N). p % * Go to beginning of file (or N percent into file). t * Go to the (N-th) next tag. T * Go to the (N-th) previous tag. { ( [ * Find close bracket } ) ]. } ) ] * Find open bracket { ( [. ESC-^F <c1> <c2> * Find close bracket <c2>. ESC-^B <c1> <c2> * Find open bracket <c1> --------------------------------------------------- Each "find close bracket" command goes forward to the close bracket matching the (N-th) open bracket in the top line. Each "find open bracket" command goes backward to the open bracket matching the (N-th) close bracket in the bottom line.
m<letter> Mark the current position with <letter>. '<letter> Go to a previously marked position. '' Go to the previous position. ^X^X Same as '. --------------------------------------------------- A mark is any upper-case or lower-case letter. Certain marks are predefined: ^ means beginning of the file $ means end of the file ---------------------------------------------------------------------------
CHANGING FILES
:e [file] Examine a new file. ^X^V Same as :e. :n * Examine the (N-th) next file from the command line. :p * Examine the (N-th) previous file from the command line. :x * Examine the first (or N-th) file from the command line. :d Delete the current file from the command line list. = ^G :f Print current file name. ---------------------------------------------------------------------------
MISCELLANEOUS COMMANDS
-<flag> Toggle a command line option [see OPTIONS below]. --<name> Toggle a command line option, by name. _<flag> Display the setting of a command line option. __<name> Display the setting of an option, by name. +cmd Execute the less cmd each time a new file is examined.
!command Execute the shell command with $SHELL. |Xcommand Pipe file between current pos & mark X to shell command. v Edit the current file with $VISUAL or $EDITOR. V Print version number of "less". ---------------------------------------------------------------------------
OPTIONS
Most options may be changed either on the command line, or from within less by using the - or -- command. Options may be given in one of two forms: either a single character preceded by a -, or a name preceded by --.
-? ........ --help Display help (from command line). -a ........ --search-skip-screen Search skips current screen. -A ........ --SEARCH-SKIP-SCREEN Search starts just after target line. -b [N] .... --buffers=[N] Number of buffers. -B ........ --auto-buffers Don't automatically allocate buffers for pipes. -c -C .... --clear-screen --CLEAR-SCREEN Repaint by clearing rather than scrolling. -d ........ --dumb Dumb terminal. -D [xn.n] . --color=xn.n Set screen colors. (MS-DOS only) -e -E .... --quit-at-eof --QUIT-AT-EOF Quit at end of file. -f ........ --force Force open non-regular files. -F ........ --quit-if-one-screen Quit if entire file fits on first screen. -g ........ --hilite-search Highlight only last match for searches. -G ........ --HILITE-SEARCH Don't highlight any matches for searches. --old-bot Revert to the old bottom of screen behavior. -h [N] .... --max-back-scroll=[N] Backward scroll limit. -i ........ --ignore-case Ignore case in searches that do not contain uppercase. -I ........ --IGNORE-CASE Ignore case in all searches. -j [N] .... --jump-target=[N] Screen position of target lines. -J ........ --status-column Display a status column at left edge of screen. -k [file] . --lesskey-file=[file] Use a lesskey file. -K --quit-on-intr Exit less in response to ctrl-C. -L ........ --no-lessopen Ignore the LESSOPEN environment variable. -m -M .... --long-prompt --LONG-PROMPT Set prompt style. -n ........ --line-numbers Don't use line numbers. -N ........ --LINE-NUMBERS Use line numbers. -o [file] . --log-file=[file] Copy to log file (standard input only). -O [file] . --LOG-FILE=[file] Copy to log file (unconditionally overwrite). -p [pattern] --pattern=[pattern] Start at pattern (from command line). -P [prompt] --prompt=[prompt] Define new prompt. -q -Q .... --quiet --QUIET --silent --SILENT Quiet the terminal bell. -r -R .... --raw-control-chars --RAW-CONTROL-CHARS Output "raw" control characters. -s ........ --squeeze-blank-lines Squeeze multiple blank lines. -S ........ --chop-long-lines Chop (truncate) long lines rather than wrapping. -t [tag] .. --tag=[tag] Find a tag. -T [tagsfile] --tag-file=[tagsfile] Use an alternate tags file. -u -U .... --underline-special --UNDERLINE-SPECIAL Change handling of backspaces. -V ........ --version Display the version number of "less". -w ........ --hilite-unread Highlight first new line after forward-screen. -W ........ --HILITE-UNREAD Highlight first new line after any forward movement. -x [N[,...]] --tabs=[N[,...]] Set tab stops. -X ........ --no-init Don't use termcap init/deinit strings. -y [N] .... --max-forw-scroll=[N] Forward scroll limit. -z [N] .... --window=[N] Set size of window. -" [c[c]] . --quotes=[c[c]] Set shell quote characters. -~ ........ --tilde Don't display tildes after end of file. -# [N] .... --shift=[N] Horizontal scroll amount (0 = one half screen width) ........ --no-keypad Don't send termcap keypad init/deinit strings. ........ --follow-name The F command changes files if the input file is renamed. ........ --use-backslash Subsequent options use backslash as escape char.
These keys can be used to edit text being entered on the "command line" at the bottom of the screen.
RightArrow ESC-l Move cursor right one character. LeftArrow ESC-h Move cursor left one character. ctrl-RightArrow ESC-RightArrow ESC-w Move cursor right one word. ctrl-LeftArrow ESC-LeftArrow ESC-b Move cursor left one word. HOME ESC-0 Move cursor to start of line. END ESC-$ Move cursor to end of line. BACKSPACE Delete char to left of cursor. DELETE ESC-x Delete char under cursor. ctrl-BACKSPACE ESC-BACKSPACE Delete word to left of cursor. ctrl-DELETE ESC-DELETE ESC-X Delete word under cursor. ctrl-U ESC (MS-DOS only) Delete entire line. UpArrow ESC-k Retrieve previous command line. DownArrow ESC-j Retrieve next command line. TAB Complete filename & cycle. SHIFT-TAB ESC-TAB Complete filename & reverse cycle. ctrl-L Complete filename, list all.
less交互指令
在使用 less 命令查看文件内容的过程中,和 more 命令一样,也会进入交互界面,因此需要读者掌握一些常用的交互指令。
交互指令
功能
/字符串
向下搜索“字符串”的功能。
?字符串
向上搜索“字符串”的功能。
n
重复*前一个搜索(与 / 成 ? 有关)。
N
反向重复前一个搜索(与 / 或 ? 有关)。
b
向上移动一页。
d
向下移动半页。
h 或 H
显示帮助界面。
q 或 Q
退出 less 命令。
y
向上移动一行。
空格键
向下移动一页。
回车键
向下移动一行。
【PgDn】键
向下移动一页。
【PgUp】键
向上移动一页。
Ctrl+f
向下移动一页。
Ctrl+b
向上移动一页。
Ctrl+d
向下移动一页。
Ctrl+u
向上移动半页。
j
向下移动一行。
k
向上移动一行。
G
移动至最后一行。
g
移动到第一行。
ZZ
退出 less 命令。
v
使用配置的编辑器编辑当前文件。
[
移动到本文档的上一个节点。
]
移动到本文档的下一个节点。
p
移动到同级的上一个节点。
u
向上移动半页。
less选项
选项
选项含义
-N
显示每行的行号。
-S
行过长时将超出部分舍弃。
-e
当文件显示结束后,自动离开。
-g
只标志最后搜索到的关键同。
-Q
不使用警告音。
-i
忽略搜索时的大小写。
-m
显示类似 more 命令的百分比。
-f
强迫打开特殊文件,比如外围设备代号、目录和二进制文件。
-s
显示连续空行为一行。
-b <缓冲区大小>
设置缓冲区的大小。
-o <文件名>
将 less 输出的内容保存到指定文件中。
-x <数字>
将【Tab】键显示为规定的数字空格。
less -N filename:显示行号
如果要 less 显示行号,请使用以下 -N 选项启动程序:
1
less -N filename
less -X filename
默认情况下, less 退出时,将从屏幕中清除文件内容。要在屏幕上保留文件内容,请使用以下 -X 选项:
1
less -X filename
[root@localhost Linux_Test]# less -X date_test.txt
2020-01-24 04:05:06
2021/4/25
[root@localhost Linux_Test]#
less +F 日志文件
该 +F 选项告诉 less 您查看文件内容可能会更改。这在打开日志文件时很有用。 less +F /var/log/messages 添加了 +F 选项的 less的表现与 tail -f 命令几乎相同。
[root@localhost ~]# vmstat procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu----- r b swpd free buff cache si so bi bo in cs us sy id wa st 1 0 0 49160 492020 2017324 0 0 57 15 108 374 10 2 87 0 0 [root@localhost ~]#
[root@localhost ~]# vmstat procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu----- r b swpd free buff cache si so bi bo in cs us sy id wa st 1 0 0 49160 492020 2017324 0 0 57 15 108 374 10 2 87 0 0 [root@localhost ~]# vmstat --help
Usage: vmstat [options] [delay [count]]
Options: -a, --active active/inactive memory -f, --forks number of forks since boot -m, --slabs slabinfo -n, --one-header do not redisplay header -s, --stats event counter statistics -d, --disk disk statistics -D, --disk-sum summarize disk statistics -p, --partition <dev> partition specific statistics -S, --unit <char> define display unit -w, --wide wide output -t, --timestamp show timestamp
-h, --help display this help and exit -V, --version output version information and exit
For more details see vmstat(8). [root@localhost ~]#
[root@localhost ~]# vmstat
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa st
0 0 0 1016976 121900 1388660 0 0 54 19 173 477 12 3 85 0 0
[root@localhost ~]# vmstat -a
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
r b swpd free inact active si so bi bo in cs us sy id wa st
0 0 0 1015720 701804 1447844 0 0 54 19 173 477 12 3 85 0 0
[root@localhost ~]# vmstat -s 3686064 K total memory 1150608 K used memory 1439196 K active memory 702928 K inactive memory 1023524 K free memory 123272 K buffer memory 1388660 K swap cache 0 K total swap 0 K used swap 0 K free swap 961982 non-nice user cpu ticks 14417 nice user cpu ticks 194461 system cpu ticks 6825684 idle cpu ticks 12403 IO-wait cpu ticks 63 IRQ cpu ticks 5608 softirq cpu ticks 0 stolen cpu ticks 4264662 pages paged in 1487185 pages paged out 0 pages swapped in 0 pages swapped out 13762036 interrupts 38103830 CPU context switches 1619001796 boot time 25897 forks [root@localhost ~]#
[root@localhost ~]# vmstat -m vmstat: your kernel does not support slabinfo or your permissions are insufficient [root@localhost ~]#
翻译:vmstat:您的内核不支持slabinfo或您的权限不足
vmstat -w宽版输出
1 2 3 4 5
[root@localhost ~]# vmstat -w procs -----------------------memory---------------------- ---swap-- -----io---- -system-- --------cpu-------- r b swpd free buff cache si so bi bo in cs us sy id wa st 3 0 0 1095624 110728 1352572 0 0 60 19 183 494 13 3 85 0 0 [root@localhost ~]#
vmstat -t显示时间
1 2 3 4 5
[root@localhost ~]# vmstat -t procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu----- -----timestamp----- r b swpd free buff cache si so bi bo in cs us sy id wa st CST 2 0 0 1067744 112572 1359264 0 0 60 19 182 493 13 3 85 0 0 2021-04-21 22:00:53 [root@localhost ~]#
vmstat -wt宽版输出并显示时间
1 2 3 4 5
[root@localhost ~]# vmstat -wt procs -----------------------memory---------------------- ---swap-- -----io---- -system-- --------cpu-------- -----timestamp----- r b swpd free buff cache si so bi bo in cs us sy id wa st CST 0 0 0 1069064 112492 1359276 0 0 60 19 182 493 13 3 85 0 0 2021-04-21 22:00:40 [root@localhost ~]#
NAME free - Display amount of free and used memory in the system
SYNOPSIS free [options]
DESCRIPTION free displays the total amount of free and used physical and swap memory in the system, as well as the buffers and caches used by the kernel. The information is gathered by parsing /proc/meminfo. The displayed columns are:
total Total installed memory (MemTotal and SwapTotal in /proc/meminfo)
used Used memory (calculated as total - free - buffers - cache)
free Unused memory (MemFree and SwapFree in /proc/meminfo)
shared Memory used (mostly) by tmpfs (Shmem in /proc/meminfo, available on kernels 2.6.32, displayed as zero if not available)
buffers Memory used by kernel buffers (Buffers in /proc/meminfo)
cache Memory used by the page cache and slabs (Cached and SReclaimable in /proc/meminfo)
buff/cache Sum of buffers and cache
available Estimation of how much memory is available for starting new applications, without swapping. Unlike the data provided by the cache or free fields, this field takes into account page cache and also that not all reclaimable memory slabs will be reclaimed due to items being in use (MemAvailable in /proc/meminfo, available on kernels 3.14, emulated on kernels 2.6.27+, otherwise the same as free)
OPTIONS -b, --bytes Display the amount of memory in bytes.
-k, --kilo Display the amount of memory in kilobytes. This is the default.
-m, --mega Display the amount of memory in megabytes.
-g, --giga Display the amount of memory in gigabytes.
--tera Display the amount of memory in terabytes.
--peta Display the amount of memory in petabytes.
-h, --human Show all output fields automatically scaled to shortest three digit unit and display the units of print out. Following units are used.
B = bytes K = kilos M = megas G = gigas T = teras P = petas
If unit is missing, and you have exabyte of RAM or swap, the number is in terabytes and columns might not be aligned with header.
-w, --wide Switch to the wide mode. The wide mode produces lines longer than 80 characters. In this mode buffers and cache are reported in two separate columns.
-c, --count count Display the result count times. Requires the -s option.
-l, --lohi Show detailed low and high memory statistics.
-s, --seconds seconds Continuously display the result delay seconds apart. You may actually specify any floating point number for delay, usleep(3) is used for microsecond resolution delay times.
--si Use power of 1000 not 1024.
-t, --total Display a line showing the column totals.
--help Print help.
-V, --version Display version information.
FILES /proc/meminfo memory information
SEE ALSO ps(1), slabtop(1), top(1), vmstat(8).
AUTHORS Written by Brian Edmonds.
REPORTING BUGS Please send bug reports to ⟨procps@freelists.org⟩
Options: -b, --bytes show output in bytes -k, --kilo show output in kilobytes -m, --mega show output in megabytes -g, --giga show output in gigabytes --tera show output in terabytes --peta show output in petabytes -h, --human show human-readable output --si use powers of 1000 not 1024 -l, --lohi show detailed low and high memory statistics -t, --total show total for RAM + swap -s N, --seconds N repeat printing every N seconds -c N, --count N repeat printing N times, then exit -w, --wide wide output
--help display this help and exit -V, --version output version information and exit
For more details see free(1). [root@localhost ~]#
-b 以Byte为单位显示内存使用情况。 -k 以KB为单位显示内存使用情况。 -m 以MB为单位显示内存使用情况。 -h 以合适的单位显示内存使用情况,最大为三位数,自动计算对应的单位值。单位有: B = bytes K = kilos M = megas G = gigas T = teras -s<间隔秒数> 持续观察内存使用状况。 -c<重复次数> -t 显示内存总和列。 -V 显示版本信息。
free -b以Byte为单位显示内存使用情况
1 2 3 4 5
[root@localhost ~]# free -b total used free shared buff/cache available Mem: 3774529536 1067212800 57638912 1544192 2649677824 2675276800 Swap: 0 0 0 [root@localhost ~]#
free -k以KB为单位显示内存使用情况
1 2 3 4 5
[root@localhost ~]# free -k total used free shared buff/cache available Mem: 3686064 1044696 53052 1508 2588316 2610079 Swap: 0 0 0 [root@localhost ~]#
free -m以MB为单位显示内存使用情况
1 2 3 4 5
[root@localhost ~]# free -m total used free shared buff/cache available Mem: 3599 1008 63 1 2527 2560 Swap: 0 0 0 [root@localhost ~]#
free -g以GB为单位显示内存使用情况
1 2 3 4 5
[root@localhost ~]# free -g total used free shared buff/cache available Mem: 3 0 0 0 2 2 Swap: 0 0 0 [root@localhost ~]#
free -h以人类友好方式显示内存使用情况
1 2 3 4 5
[root@localhost ~]# free -h total used free shared buff/cache available Mem: 3.5G 1.0G 61M 1.5M 2.4G 2.5G Swap: 0B 0B 0B [root@localhost ~]#
free -w
1 2 3 4 5
[root@localhost ~]# free -w total used free shared buffers cache available Mem: 3686064 1084684 54540 1508 464712 2082128 2570087 Swap: 0 0 0 [root@localhost ~]#
free -t以总和的形式查询内存的使用信息
1 2 3 4 5 6
[root@localhost ~]# free -t total used free shared buff/cache available Mem: 3686064 1087824 50896 1508 2547344 2566951 Swap: 0 0 0 Total: 3686064 1087824 50896 [root@localhost ~]#
free -s 秒数:周期性的查询内存使用信息
free -s 10表示每隔10秒执行一次free命令。
1 2 3 4 5 6 7 8 9 10 11 12 13 14
[root@localhost ~]# free -s 10 total used free shared buff/cache available Mem: 3686064 1080672 56516 1508 2548876 2574103 Swap: 0 0 0
total used free shared buff/cache available Mem: 3686064 1072048 65064 1508 2548952 2582727 Swap: 0 0 0
total used free shared buff/cache available Mem: 3686064 1077880 59172 1508 2549012 2576895 Swap: 0 0 0
......
free -s 间隔秒数 -c 执行次数:周期性执行free并统计次数
1 2
-s N, --seconds N repeat printing every N seconds -c N, --count N repeat printing N times, then exit
命令free -s 5 -c 3表示每隔5秒执行一次free命令,并重复执行3次。 运行结果:
1 2 3 4 5 6 7 8 9 10 11 12 13
[root@localhost ~]# free -s 5 -c 3 total used free shared buff/cache available Mem: 3686064 1084308 51740 1508 2550016 2570467 Swap: 0 0 0
total used free shared buff/cache available Mem: 3686064 1082564 53464 1508 2550036 2572211 Swap: 0 0 0
total used free shared buff/cache available Mem: 3686064 1080316 55648 1508 2550100 2574459 Swap: 0 0 0 [root@localhost ~]#