「chcpu(8)」-

对CPU进行配置
命令语法格式
chcpu -c|-d|-e|-g cpu-list
chcpu -p mode
chcpu -r|-h|-V
命令描述
命令chcpu可以修改CPU的状态。 它可以启用CPU、禁用CPU、扫描新CPU、更改底层hypervisor的CPU调度模式,以及从hypervisor(配置)请求CPU、或将CPU返回到hypervisor(解除配置)。
一些选项有一个cpu-list参数。 使用此参数指定时,以逗号分隔的CPU列表。该列表可以包含单个CPU地址或地址范围。 例如,0,5,7,9-11使命令适用于地址为0,5,7,9,10,11的CPU。
命令支持的选项及含义
-c, –configure cpu-list 配置指定的CPU。 配置CPU意味着:hypervisor从CPU池中获取CPU,并将其分配给运行内核的虚拟硬件。
-d, –disable cpu-list 禁用指定的CPU。 禁用CPU意味着:内核将其设置为离线状态。
-e, –enable cpu-list 启用指定的CPU。 启用CPU意味着:内核将其设置为在线状态。请参阅-c选项,必须先配置CPU,然后才能启用它。
-g, –deconfigure cpu-list 取消指定CPU的配置。取消CPU配置意味着:hypervisor从运行Linux实例的虚拟硬件中删除CPU并将其返回到CPU池。在取消配置之前,CPU必须处于脱机状态,请参阅-d选项。
-p, –dispatch mode 设置CPU调度模式(极化,polarization)。 仅当硬件体系结构和虚拟机管理程序支持CPU极化时,此选项才有效。 可用的mode是:

horizontal,工作负载分布在所有可用的CPU上。
vertical,工作负载集中在少数CPU上。

-r, –rescan 触发重新扫描的CPU。 重新扫描后,Linux内核会识别新的CPU。在不自动检测新连接的CPU的系统上,可以使用此选项。
其他选项
-h, –help 显示帮助信息。
-V, –version 显示版本信息。
退出状态
0 成功;
1 失败;
64 部分成功;
相关手册
lscpu(1)
参考文献

man 8 chcpu, Version chcpu from util-linux 2.32

更新日志

07/11/2018 创建文章[……]

READ MORE

「chrt」-

chrt – manipulate the real-time attributes of a process

命令语法格式

chrt [options] priority command [argument…]
chrt [options] -p [priority] pid

命令描述

chrt sets or retrieves the real-time scheduling attributes of an existing pid, or runs command with the given attributes.

POLICIES

-o, –other

Set scheduling policy to SCHED_OTHER. This is the default Linux scheduling policy.

-f, –fifo

Set scheduling policy to SCHED_FIFO.

-r, –rr

Set scheduling policy to SCHED_RR. When no policy is defined, the SCHED_RR is used as the default.

-b, –batch

Set scheduling policy to SCHED_BATCH (Linux-specific, supported since 2.6.16). The priority argument has to be set to zero.

-i, –idle

Set scheduling policy to SCHED_IDLE (Linux-specific, supported since 2.6.23). The priority argument has to be set to zero.

-d, –deadline

Set scheduling policy to SCHED_DEADLINE (Linux-specific, supported since 3.14). The priority argument has to be set to zero. See also –sched-runtime, –sched-deadline and –sched-period. The re[……]

READ MORE

「col(1)」-

从输入过滤反向换行
命令语法格式
col [-bfhpx] [-l num]
命令描述
命令col过滤掉反向换行符和半反向换行符,以便输出的顺序正确,且只包含正向换行符和半正向换行,并在可能的情况下用制表符替换空白字符。这在处理nroff(1)和tbl(1)的输出时非常有用。
命令col从标准输入读取,并写入标准输出。
关于换行、反向换行等概念参考文章「What is a reverse line feed」、「Newline」。
命令支持的选项及含义
-b 不输出任何退格,仅打印写入每个列位置的最后一个字符。
-f 允许半正向换行符(“fine”模式)。通常,打印在半行边界上的字符会被打印在紧跟的行中。
-l num 至少在内存中缓冲num行。默认缓冲128行。
-p 通过不变,强制未知的控制序列。通常,命令col将从输入中过滤掉除自身识别和解释的控制序列之外的任何控制序列,如下所列。
-h 不要输出多个空格,而是输出制表符(TAB)。
-x 输出多个空格,而不是制表符。
下表列出了命令col理解的回车的控制序列及其十进制值:
ESC-7 reverse line feed (escape then 7)
ESC-8 half reverse line feed (escape then 8)
ESC-9 half forward line feed (escape then 9)
backspace moves back one column (8); ignored in the first column
carriage return (13)
newline forward line feed (10); also does carriage return
shift in shift to normal character set (15)
shift out shift to alternate character set (14)
space moves forward one column (32)
tab moves forward to next tab stop (9)
vertical tab reverse line feed (11)

所有无法识别的控制字符和转义序列都会被丢弃。
命令col实用程序会在读取字符时跟踪字符集,并确保输出时字符集正确。
如果输入尝试返回到上一个已刷出的行,则col将显示警告消息。
注[……]

READ MORE

「colcrt(1)」-

过滤器nroff输出,用于CRT预览
命令语法格式
colcrt [-] [-2] [file …]
命令描述
命令colcrt提供虚拟半行和反向LF序列(为没有这种能力的终端),并且在这种终端上高亮是破坏性的。 半行字符和下划线(更改为划线“-”)放在正常输出行之间的新行上。
命令支持的选项及含义
– 抑制所有下划线。此选项对于从tbl(1)预览所有已装箱的表格尤其有用。
-2 导致所有半行打印,有效地使输出双倍间隔。 通常,使用最小空间输出格式来抑制空行。 但是,该程序从不抑制两个连续的空行。 当输出包含将不可见的上标和下标时,选项-2对于将输出发送到行式打印机非常有用。
注意事项
即使使用’ – ‘选项也应该将下划线折叠到空白处,以便显示真正的下划线字符。
无法向后达到超过102行。
一般突出显示会丢失;作为一个特殊情况:带有“-”的“|”突出显示会变为“+”。
行被修剪为132个字符。
应该为处理已经是双倍行距的文件中的上标和下标做出一些规定。
占用多个列位置的字符可能无法正确加下划线。
相关环境变量
LANG, LC_ALL, LC_CTYPE 这些环境变量会影响colcrt的执行,参考environ(7)手册。
退出状态
0 成功;
>0 失败;
使用示例
命令colcrt的一个典型用法:

# tbl exum2.n | nroff -ms | colcrt – | more

如上示例。
相关手册
col(1), more(1), nroff(1), troff(1), ul(1)
参考文献

man 1 colcrt, Version 9.0.12

更新日志

10/05/2018 创建文章[……]

READ MORE

「column(1)」-

列化列表
命令语法格式
column [-entx] [-c columns] [-s sep] [file …]
命令描述
命令column将其输入格式化为多个列。在列之前填充行。输入可以来自文件,或默认情况下来自标准输入。除非使用-e选项,否则将忽略空行。
命令支持的选项及含义
-s sep 指定一组字符,用于分隔-t选项的列。
注意:该组字符是列的分隔标志,而不时输出时分隔列的字符。
-t 确定输入包含的列数并创建表。 默认情况下,列用空格分隔,或使用-s选项提供的字符分隔。 适用于漂亮的打印显示。
-n 默认情况下,命令column会在使用-t选项时,将多个相邻分隔符合并为单个分隔符。 此选项禁用该行为。
此选项是Debian GNU/Linux扩展。
-c columns 输出格式化为显示columns列宽。
-x 在填充行之前填充列。
-e 不要忽略空白行。
注意事项
输入行的长度限制为LINE_MAX(1M)宽字符的512倍。
相关环境变量
COLUMNS, LANG, LC_ALL, LC_CTYPE 这些选项会影响column的执行,参考environ手册。
退出状态
0 成功;
>0 发生错误;
使用示例
指定列的分隔标志为数字3:

# echo 12312312312312312321312321 | column -s 3 -t
12 12 12 12 12 12 21 12 21

列化ls命令的输出,使结果的可读性更高:

# (printf “PERM LINKS OWNER GROUP SIZE MONTH DAY ” ; printf “HH:MM/YEAR NAME\n” ; ls -l | sed 1d) | column -t

如上示例。
相关手册
colrm(1), ls(1), paste(1), sort(1)
参考文献

man 1 column, Version column from util-linux 2.32

更新日志

07/11/2018 创建文章[……]

READ MORE

「ctrlaltdel(8)」-

设置Ctrl-Alt-Del组合的功能
命令语法格式
ctrlaltdel hard|soft
命令描述
基于linux/kernel/reboot.c代码的检查,很明显序列Ctrl-Alt-Del可以执行两个支持的功能:

hard:立即重新启动计算机,而不调用sync(2),并且不做任何其他准备。这是默认值。

soft:使内核将SIGINT(中断)信号发送到init进程(这始终是PID为“1”的进程)。如果使用此选项,init(8)程序必须支持此功能。 由于Linux社区中现在有几个init(8)程序,请查阅当前使用的版本的文档。

当命令ctrlaltdel在没有任何参数的情况下运行时,它将显示当前设置。
组合ctrlaltdel的功能通常在/etc/rc.local文件中设置。
命令支持的选项及含义
-V, –version 显示版本信息并退出。
-h, –help 显示帮助信息并退出。
相关文件
/etc/rc.local
相关手册
init(8), systemd(1)
参考文献

man 8 ctrlaltdel, Version ctrlaltdel from util-linux 2.32

更新日志

07/11/2018 创建文章[……]

READ MORE

「delpart(8)」-

告诉内核忘记分区
命令语法格式
delpart device partition
命令描述
命令delpart要求Linux内核忘记指定设备上的指定分区(数字)。该命令是围绕ioctl(2)“删除分区”的简单包装。
此命令不会操作块设备上的分区。
相关手册
addpart(8), fdisk(8), parted(8), partprobe(8), partx(8)
参考文献

man 8 delpart, Version delpart from util-linux 2.32

更新日志

07/11/2018 创建文章[……]

READ MORE

「dmesg」-

dmesg – print or control the kernel ring buffer

命令语法格式

dmesg [options]

dmesg –clear
dmesg –read-clear [options]
dmesg –console-level level
dmesg –console-on
dmesg –console-off

命令描述

dmesg is used to examine or control the kernel ring buffer.

The default action is to display all messages from the kernel ring buffer.

命令支持的选项及含义

The –clear, –read-clear, –console-on, –console-off, and –console-level options are mutually exclusive.

-C, –clear

Clear the ring buffer.

-c, –read-clear

Clear the ring buffer after first printing its contents.

-D, –console-off

Disable the printing of messages to the console.

-d, –show-delta

Display the timestamp and the time delta spent between messages. If used together with –notime then only the time delta without the timestamp is printed.

-E, –console-on

Enable printing messages to the console.

-e, –reltime

Display the local time and the delta in human-readable format. Be aware that conversion[……]

READ MORE

「eject」-

eject – eject removable media

命令语法格式

eject -h
eject [-vnrsfmqp] [<name>]
eject [-vn] -d
eject [-vn] -a on|off|1|0 [<name>]
eject [-vn] -c slot [<name>]
eject [-vn] -i on|off|1|0 [<name>]
eject [-vn] -t [<name>]
eject [-vn] -T [<name>]
eject [-vn] -x <speed> [<name>]
eject [-vn] -X [<name>]
eject -V

命令描述

Eject allows removable media (typically a CD-ROM, floppy disk, tape, or JAZ or ZIP disk) to be ejected under software control. The command can also control some multi-disc CD-ROM changers, the auto-eject feature supported by
some devices, and close the disc tray of some CD-ROM drives.

The device corresponding to <name> is ejected. The name can be a device file or mount point, either a full path or with the leading “/dev”, “/media” or “/mnt” omitted. If no name is specified, the default name “cdrom” is
used.

There are four different methods of ejecting, depending on whether the device is a CD-ROM, SCSI device, removable floppy, or tape. By default eject tries all four methods in order until it succeeds.[……]

READ MORE

「fallocate」-

fallocate – preallocate or deallocate space to a file

命令语法格式

fallocate [-c|-p|-z] [-o offset] -l length [-n] filename

fallocate -d [-o offset] [-l length] filename

fallocate -x [-o offset] -l length filename

命令描述

fallocate is used to manipulate the allocated disk space for a file, either to deallocate or preallocate it. For filesystems which support the fallocate system call, preallocation is done quickly by allocating blocks and
marking them as uninitialized, requiring no IO to the data blocks. This is much faster than creating a file by filling it with zeroes.

The exit code returned by fallocate is 0 on success and 1 on failure.

命令支持的选项及含义

The length and offset arguments may be followed by the multiplicative suffixes KiB (=1024), MiB (=1024*1024), and so on for GiB, TiB, PiB, EiB, ZiB and YiB (the “iB” is optional, e.g., “K” has the same meaning as “KiB”) or
the suffixes KB (=1000), MB (=1000*1000), and so on for GB, TB, PB, EB, ZB and YB.

The options –collapse-range, –dig-holes, –punch-hole and –zero-range are mutually exclusive.

-c, -[……]

READ MORE

「fdformat(8)」-

低级格式化软盘
命令语法格式
fdformat [options] device
命令描述
命令fdformat在软盘上执行低级格式化。参数device通常是以下之一(对于软盘设备,major = 2,而minor显示仅供参考):

/dev/fd0d360 (minor = 4)
/dev/fd0h1200 (minor = 8)
/dev/fd0D360 (minor = 12)
/dev/fd0H360 (minor = 12)
/dev/fd0D720 (minor = 16)
/dev/fd0H720 (minor = 16)
/dev/fd0h360 (minor = 20)
/dev/fd0h720 (minor = 24)
/dev/fd0H1440 (minor = 28)

/dev/fd1d360 (minor = 5)
/dev/fd1h1200 (minor = 9)
/dev/fd1D360 (minor = 13)
/dev/fd1H360 (minor = 13)
/dev/fd1D720 (minor = 17)
/dev/fd1H720 (minor = 17)
/dev/fd1h360 (minor = 21)
/dev/fd1h720 (minor = 25)
/dev/fd1H1440 (minor = 29)

当使用非标准格式时,或者如果之前未自动检测格式,通用软盘设备(/dev/fd0和/dev/fd1)将无法使用fdformat处理。 在这种情况下,使用setfdprm(8)加载磁盘参数。
命令支持的选项及含义
-f, –from N 从轨道N开始(默认为0)。
-t, –to N 从轨道N停止(默认为0)。
-r, –repair N 尝试在验证期间修复失败的轨道(最多N次重试)。
-n, –no-verify 跳过在格式化后通常会执行的验证。
-h, –help 显示帮助信息。
-V, –version 显示版本信息。
相关手册
fd(4), emkfs(8), mkfs(8), setfdprm(8)
参考文献

man 8 fdformat, Version fdformat from util-linux 2.32

更新日志

07/11/2018 创建文章[……]

READ MORE

「fdisk」-

操作硬盘分区表
命令语法格式
fdisk [options] device
fdisk -l [device…]
命令描述
命令fdisk是一个由对话框驱动的程序,用于创建和操作分区表。它可以理解GPT、MBR、Sun、SGI、BSD分区表。
块设备可以分为一个或多个称为分区的逻辑磁盘。此划分记录在“分区表”中,通常位于磁盘的“扇区零”中。 (在BSD世界中,人们谈论的是“磁盘片”(disk slice)和“磁盘标签”(disklabel))
默认情况下,所有分区都由设备I/O限制(拓扑)驱动。命令fdisk能够针对4K扇区大小优化磁盘布局,并在现代设备上使用MBR和GPT的对齐偏移。将fdisk的默认值作为默认值始终是一个好主意(例如,第一个和最后一个分区扇区),并且“+<size>{M,G,…}表示法”指定的分区大小始终是根据设备属性进行对齐 。
请注意,partx(8)为脚本提供了丰富的界面来打印磁盘布局,而fdisk主要是为人类设计的。不保证fdisk输出的向后兼容性。输入(命令)应始终向后兼容。
命令行选项
-b, –sector-size sectorsize 指定磁盘的扇区大小。有效值为512,1024,2048,4096.(最近的内核版本知道扇区大小。仅在旧内核上使用此选项,或者覆盖内核的想法。)自util-linux-2.17起,fdisk区分逻辑扇区和物理扇区大小。 此选项将扇区大小更改为sectorsize。
-B, –protect-boot 创建新磁盘标签时,请勿擦除第一个磁盘扇区的开头。为GPT和MBR支持此功能。
-c, –compatibility[=mode] 指定兼容模式,’dos’或’nondos’。默认为非DOS模式。 为了向后兼容,可以使用不带mode参数的选项,此时使用默认值。 请注意,可选mode参数不能通过空格与-c选项分隔,正确的形式例如是“-c=dos”。
-L, –color[=when] 着色输出。 可选参数何时可以是auto,never,always。 如果省略when参数,则默认为auto。 颜色可以禁用;对于当前内置的默认值,请参阅–help输出。 另请参阅「颜色」部分。
-l, –list 列出指定设备device的分区表,然后退出。 如果没有给出设备,则使用/proc/partitions中提到的那些设备(如果该文件存在)。
-o, –output list 指定要打印的输出列。 使用–help获取所有支持列的列表。
如果以格式+list(例如-o +UUID)指定列表,则可以扩展默认列的列表。
-s, –getsz 在每个给定块设备[……]

READ MORE

「findfs(8)」-

根据标签或者UUID查找文件系统
命令语法格式
findfs NAME=value
命令描述
命令findfs将搜索系统中的块设备,查找具有指定标记的文件系统或分区。
如果找到文件系统或分区,则将在标准错误上打印设备名称。
命令支持的标签
LABEL=<label> 指定文件系统的标签。
UUID=<uuid> 指定文件系统的UUID。
PARTUUID=<uuid> 指定分区UUID。例如,GUID分区表(GPT)分区表支持此分区标识符。
PARTLABEL=<label> 指定分区标签(名称)。 例如,GUID分区表(GPT)或MAC分区表支持分区标签。
注意事项
有关文件系统和分区的完整概述,例如,可以通过

# lsblk –fs
# partx –show <disk>
# blkid

如上命令获得。
相关环境变量
LIBBLKID_DEBUG=all 启用libblkid调试输出。
退出状态
0 成功
1 标签或者UUID未找到
2 用法、参数数值、未知选项错误
相关手册
blkid(8), lsblk(8), partx(8)
参考文献

man 8 findfs, Version findfs from util-linux 2.32

更新日志

07/11/2018 创建文章[……]

READ MORE

「findmnt」-

findmnt – find a filesystem

命令语法格式

findmnt [options]

findmnt [options] device|mountpoint

findmnt [options] [–source] device [–target|–mountpoint] mountpoint

命令描述

findmnt will list all mounted filesystems or search for a filesystem. The findmnt command is able to search in /etc/fstab, /etc/mtab or /proc/self/mountinfo. If device or mountpoint is not given, all filesystems are shown.

The device may be specified by device name, major:minor numbers, filesystem label or UUID, or partition label or UUID. Note that findmnt follows mount(8) behavior where a device name may be interpreted as a mountpoint (and
vice versa) if the –target, –mountpoint or –source options are not specified.

The command prints all mounted filesystems in the tree-like format by default.

命令支持的选项及含义

-A, –all

Disable all built-in filters and print all filesystems.

-a, –ascii

Use ascii characters for tree formatting.

-b, –bytes

Print the SIZE, USED and AVAIL columns in bytes rather than in a human-readable format.

-[……]

READ MORE

「flock」-

flock – manage locks from shell scripts

命令语法格式

flock [options] file|directory command [arguments]
flock [options] file|directory -c command
flock [options] number

命令描述

This utility manages flock(2) locks from within shell scripts or from the command line.

The first and second of the above forms wrap the lock around the execution of a command, in a manner similar to su(1) or newgrp(1). They lock a specified file or directory, which is created (assuming appropriate permis‐
sions) if it does not already exist. By default, if the lock cannot be immediately acquired, flock waits until the lock is available.

The third form uses an open file by its file descriptor number. See the examples below for how that can be used.

命令支持的选项及含义

-c, –command command

Pass a single command, without arguments, to the shell with -c.

-E, –conflict-exit-code number

The exit code used when the -n option is in use, and the conflicting lock exists, or the -w option is in use, and the timeout is reached. The default value is 1.

-F, –no-fork

Do not fork bef[……]

READ MORE

「fsck.cramfs(8)」-

对压缩的ROM文件系统检查和修复
命令语法格式
fsck.cramfs [options] file
命令描述
命令fsck.cramfs用于检查cramfs文件系统。
命令支持的选项及含义
-v, –verbose 启用消息的消息输出。
–extract[=directory] 测试解压缩整个文件系统。(可选)将文件的内容提取到directory目录。
-b, –blocksize blocksize 使用此块大小,默认为页大小。该blocksize必须等于创建时设置的值。仅用于–extract选项。
其他选项
-a 该选项被静默的忽略。
-y 该选项被静默的忽略。
-V, –version 显示版本信息并退出。
-h, –help 显示帮助信息并退出。
退出状态
0 成功;
4 文件系统未经修正;
8 操作错误,如无法分配内存;
16 打印使用信息;
相关手册
mount(8), mkfs.cramfs(8)
参考文献

man 8 cramfs, Version fsck.cramfs from util-linux 2.32

更新日志

07/11/2018 创建文章[……]

READ MORE

「fsck.minix」-

fsck.minix – check consistency of Minix filesystem

命令语法格式

fsck.minix [options] device

命令描述

fsck.minix performs a consistency check for the Linux MINIX filesystem.

The program assumes the filesystem is quiescent. fsck.minix should not be used on a mounted device unless you can be sure nobody is writing to it. Remember that the kernel can write to device when it searches for files.

The device name will usually have the following form:

/dev/hda[1–63] IDE disk 1
/dev/hdb[1–63] IDE disk 2
/dev/sda[1–15] SCSI disk 1
/dev/sdb[1–15] SCSI disk 2

If the filesystem was changed, i.e., repaired, then fsck.minix will print “FILE SYSTEM HAS CHANGED” and will sync(2) three times before exiting. There is no need to reboot after check.

WARNING

fsck.minix should not be used on a mounted filesystem. Using fsck.minix on a mounted filesystem is very dangerous, due to the possibility that deleted files are still in use, and can seriously damage a perfectly good
filesystem! If you absolutely have to run fsck.minix on a mounted filesystem, such as the root filesystem, make s[……]

READ MORE

「fsck」-

fsck – check and repair a Linux filesystem

命令语法格式

fsck [-lsAVRTMNP] [-r [fd]] [-C [fd]] [-t fstype] [filesystem…] [–] [fs-specific-options]

命令描述

fsck is used to check and optionally repair one or more Linux filesystems. filesys can be a device name (e.g. /dev/hdc1, /dev/sdb2), a mount point (e.g. /, /usr, /home), or an ext2 label or UUID specifier (e.g.
UUID=8868abf6-88c5-4a83-98b8-bfc24057f7bd or LABEL=root). Normally, the fsck program will try to handle filesystems on different physical disk drives in parallel to reduce the total amount of time needed to check all of
them.

If no filesystems are specified on the command line, and the -A option is not specified, fsck will default to checking filesystems in /etc/fstab serially. This is equivalent to the -As options.

The exit code returned by fsck is the sum of the following conditions:

0 No errors
1 Filesystem errors corrected
2 System should be rebooted
4 Filesystem errors left uncorrected
8 Operational error
16 Usage or syntax error
32 Checking canceled by user request
128 Shared-library error[……]

READ MORE

「fsfreeze(8)」-

暂停对文件系统的访问(Ext3/4,ReiserFS,JFS,XFS)
命令语法格式
fsfreeze –freeze|–unfreeze mountpoint
命令描述
命令fsfreeze暂停或恢复对文件系统的访问。
命令fsfreeze停止对文件系统的任何新访问,并在磁盘上创建稳定的映像。命令fsfreeze旨在与支持创建快照的硬件RAID设备一起使用。
设备映射器设备不需要fsfreeze。 请求创建快照时,设备映射器(和LVM)会自动冻结设备上的文件系统。 有关更多详细信息,请参见dmsetup(8)手册页。
参数mountpoint是被挂载的文件系统的目录的路径名。必须是挂载的文件系统才能冻结(请参阅mount(8))。
请注意,如果使用传统的atime行为挂载文件系统,则也会暂停访问时间更新(挂载选项strictatime,有关详细信息,请参阅mount(8))。
命令支持的选项及含义
-f, –freeze 此选项要求从新修改中冻结指定的文件系统。 选择此选项后,允许文件系统中所有正在进行的事务完成,暂停新的写入系统调用,停止修改文件系统的其他调用,并将所有脏数据、元数据、日志信息写入磁盘。 尝试写入冻结文件系统的任何进程都将阻塞,等待文件系统解冻。
请注意,即使在冻结之后,磁盘上的文件系统也可以包含仍处于取消链接过程中的文件的信息。 在解冻文件系统或完成快照的干净安装之前,不会取消链接这些文件。
-u, –unfreeze 此选项用于取消冻结文件系统,并允许操作继续。因冻结而阻止的任何文件系统修改都将被解除阻止,并被允许完成存操作。
-V, –version 显示版本信息并退出。
-h, –help 显示帮助信息并退出。
注意事项
该手册页基于xfs_freeze(8)手册。
支持的文件系统
仅当文件系统支持支持冻结时,此命令才有效。 这些文件系统的列表包括(2016-12-18)btrfs,ext2/3/4,f2fs,jfs,nilfs2,reiserfs,xfs。以前的列表可能不完整,因为更多的文件系统得到了支持。 如果有疑问,知道文件系统是否支持的最简单方法是:创建一个小的环回挂载,并测试冻结它。
相关手册
mount(8)
参考文献

man 8 fsfreeze, Version fsfreeze from util-linux 2.32

更新日志

07/11/2018 创建文章[……]

READ MORE

「fstrim(8)」-

丢弃在已挂载文件系统上的未使用块
命令语法格式
fstrim [-a] [-o offset] [-l length] [-m minimum-size] [-v] mountpoint
命令描述
命令fstrim用于已挂载的文件系统,以丢弃(或“修剪(trim)”)文件系统未使用的块。 这对于固态驱动器(SSD)和精简配置存储非常有用。
默认情况下,fstrim将丢弃文件系统中所有未使用的块。可以使用选项基于范围或大小来控制此行为,如下所述。
参数mountpoint是安装文件系统的目录的路径名。
经常运行fstrim,甚至使用mount -o discard,可能会对劣质SSD设备的使用寿命产生负面影响。对于大多数台式机和服务器系统,每周一次的修剪频率是足够的。 请注意,并非所有设备都支持排队修剪,因此每个修剪命令都会对当时尝试使用该磁盘的任何其他设备造成性能损失。
命令支持的选项及含义
offset, length, minimum-size 这三个参数可以跟随乘法后缀:

KiB(=1024),MiB(=1024*1024),GiB,TiB,PiB,EiB,ZiB,YiB依此类推。其中,iB是可选的,例如“K”具有与“KiB”相同的含义。
或使用后缀KB(=1000),MB(=1000*1000),GB,TB,PB,EB,ZB,YB依此类推。

-a, –all 在支持丢弃操作的设备上,修剪所有已挂载的文件系统。 其他提供的选项,如–offset,–length,–minimum,将应用于所有这些设备。由不支持丢弃操作的文件系统产生的错误,默认忽略。
-o, –offset offset 文件系统中的字节偏移量,从中开始搜索要丢弃的空闲块。 默认值为零,表示从文件系统的开头开始。
-l, –length length 搜索要丢弃的空闲块的字节数(在起始点之后)。 如果指定的值超出文件系统的末尾,则fstrim将停止在文件系统大小边界处。 默认值扩展到文件系统的末尾。
-m, –minimum minimum-size 要丢弃的最小连续可用范围,以字节为单位。 (此值在内部向上舍入为文件系统块大小的倍数。)将忽略小于此值的可用范围。 通过增加此值,对于具有严重碎片的可用空间的文件系统,fstrim操作将更快地完成,但并非所有块都将被丢弃。 默认值为零,丢弃每个空闲块。
-v, –verbose 详细执行。 使用此选项,fstrim将输出从文件系统传递到块堆栈到设备的字节数,以便进行潜在的丢弃。 从存储设备的角度来看,这个数字是最大丢弃量,因为重复调用的FITRIM ioctl将继续发送相同的扇区以便重复丢[……]

READ MORE

「getopt」-

getopt – parse command options (enhanced)

命令语法格式

getopt optstring parameters
getopt [options] [–] optstring parameters
getopt [options] -o|–options optstring [options] [–] parameters

命令描述

getopt is used to break up (parse) options in command lines for easy parsing by shell procedures, and to check for legal options. It uses the GNU getopt(3) routines to do this.

The parameters getopt is called with can be divided into two parts: options which modify the way getopt will do the parsing (the options and the optstring in the SYNOPSIS), and the parameters which are to be parsed (parame‐
ters in the SYNOPSIS). The second part will start at the first non-option parameter that is not an option argument, or after the first occurrence of ‘–‘. If no ‘-o’ or ‘–options’ option is found in the first part, the
first parameter of the second part is used as the short options string.

If the environment variable GETOPT_COMPATIBLE is set, or if the first parameter is not an option (does not start with a ‘-‘, the first format in the SYNOPSIS), getopt will generate output that is compatible with that of
other ve[……]

READ MORE

「hexdump」-

hexdump, hd — ASCII, decimal, hexadecimal, octal dump
命令语法格式
hexdump [-bcCdovx] [-e format_string] [-f format_file] [-n length] [-s skip] file … hd [-bcdovx] [-e format_string] [-f format_file] [-n length] [-s skip] file …
命令描述
The hexdump utility is a filter which displays the specified files, or the standard input, if no files are specified, in a user specified format.
The options are as follows:
-b One-byte octal display. Display the input offset in hexadecimal, followed by sixteen space-separated, three column, zero-filled, bytes of input data, in octal, per line.
-c One-byte character display. Display the input offset in hexadecimal, followed by sixteen space-separated, three column, space-filled, characters of input data per line.
-C Canonical hex+ASCII display. Display the input offset in hexadecimal, followed by sixteen space-separated, two column, hexadecimal bytes, followed by the same sixteen bytes in %_p format enclosed in “|” characters.

Calling the command hd implies this option.

-d Two-byte decimal display. Display the input offset in hexadecimal, followed by eight space-separated, five column, zero-filled, two-by[……]

READ MORE

「hwclock」-

hwclock – time clocks utility

命令语法格式

hwclock [function] [option…]

命令描述

hwclock is an administration tool for the time clocks. It can: display the Hardware Clock time; set the Hardware Clock to a specified time; set the Hardware Clock from the System Clock; set the System Clock from the Hard‐
ware Clock; compensate for Hardware Clock drift; correct the System Clock timescale; set the kernel’s timezone, NTP timescale, and epoch (Alpha only); and predict future Hardware Clock values based on its drift rate.

Since v2.26 important changes were made to the –hctosys function and the –directisa option, and a new option –update-drift was added. See their respective descriptions below.

FUNCTIONS

The following functions are mutually exclusive, only one can be given at a time. If none is given, the default is –show.

-a, –adjust

Add or subtract time from the Hardware Clock to account for systematic drift since the last time the clock was set or adjusted. See the discussion below, under The Adjust Function.

–getepoch
–setepoch

These functions are for Alpha mach[……]

READ MORE

「i386」-

setarch – change reported architecture in new program environment and set personality flags

命令语法格式

setarch arch [options] [program [argument…]]

arch [options] [program [argument…]]

setarch –list|-h|-V

命令描述

setarch currently only affects the output of uname -m. For example, on an AMD64 system, running setarch i386 program will cause program to see i686 instead of x86_64 as the machine type. It also allows to set various per‐
sonality options. The default program is /bin/sh.

命令支持的选项及含义

–list List the architectures that setarch knows about. Whether setarch can actually set each of these architectures depends on the running kernel.

–uname-2.6

Causes the program to see a kernel version number beginning with 2.6. Turns on UNAME26.

-v, –verbose

Be verbose.

-3, –3gb

Specifies program should use a maximum of 3GB of address space. Supported on x86. Turns on ADDR_LIMIT_3GB.

–4gb This option has no effect. It is retained for backward compatibility only, and may be removed in future releases.[……]

READ MORE

「ionice」-

ionice – set or get process I/O scheduling class and priority

命令语法格式

ionice [-c class] [-n level] [-t] -p PID…
ionice [-c class] [-n level] [-t] -P PGID…
ionice [-c class] [-n level] [-t] -u UID…
ionice [-c class] [-n level] [-t] command [argument…]

命令描述

This program sets or gets the I/O scheduling class and priority for a program. If no arguments or just -p is given, ionice will query the current I/O scheduling class and priority for that process.

When command is given, ionice will run this command with the given arguments. If no class is specified, then command will be executed with the “best-effort” scheduling class. The default priority level is 4.

As of this writing, a process can be in one of three scheduling classes:

Idle A program running with idle I/O priority will only get disk time when no other program has asked for disk I/O for a defined grace period. The impact of an idle I/O process on normal system activity should be zero.

This scheduling class does not take a priority argument. Presently, this scheduling class is permitted for an ordinary user (since ker[……]

READ MORE

「ipcmk(1)」-

制作各种IPC资源
命令语法格式
ipcmk [options]
命令描述
命令ipcmk允许您创建共享内存段、消息队列、信号量。
命令支持的选项及含义
指定资源
-M, –shmem size 创建大小为size字节的共享内存段。参数size之后可以是乘法后缀:KiB(=1024),MiB(=1024*1024),同理GiB等等。(“iB”是可选的,例如,“K”与“KiB”同义)。或也可以后缀KB(=1000),MB(=1000*1000)等。
-Q, –queue 创建一个消息队列。
-S, –semaphore number 创建一个包含多个元素的信号量数组。
其他选项
-p, –mode mode 资源的访问权限。 默认值为0644。
-V, –version 显示版本信息并退出。
-h, –help 显示帮助信息并退出。
相关手册
ipcrm(1), ipcs(1)
参考文献

man 1 ipcmk, Version ipcmk from util-linux 2.32

更新日志

07/11/2018 创建文章[……]

READ MORE

「ipcrm(1)」-

删除某些IPC资源
命令语法格式
ipcrm [options]
ipcrm {shm|msg|sem} id…
命令描述
命令ipcrm从系统中删除System V进程间通信(IPC)对象和相关的数据结构。要删除此类对象,您必须是超级用户,或对象的创建者或所有者。
System V IPC对象有三种类型:共享内存、消息队列、信号量。删除消息队列或信号量对象是立即的(无论任何进程是否仍保留对象的IPC标识符)。只有当所有当前连接的进程从其虚拟地址空间分离(shmdt(2))对象后,才会删除共享内存对象。
支持两种语法样式:

旧的Linux历史语法指定一个“三字母”关键字,指示要删除哪个类对象,后跟一个或多个此类对象的IPC id。
符合SUS的语法允许在单个命令行中指定所有三种类型的零个或多个对象,其中对象由key或id指定(参见下文)。key和id都可以用十进制、十六进制(用初始’0x’或’0X’指定)、八进制(用初始’0’指定)来指定。

手册shmctl(2),msgctl(2)和semctl(2)中描述了删除的细节。可以使用ipcs(1)找到key和id。
命令支持的选项及含义
-a, –all [shm] [msg] [sem] 删除所有资源。提供选项参数时,仅对指定的资源类型执行删除操作。
警告! 如果您不确定使用资源的软件如何对丢失的对象进行反应,请不要使用-a选项。 有些程序在启动时创建这些资源,可能没有任何代码来处理意外的消失。
-M, –shmem-key shmkey 执行最后一次分离后,删除使用shmkey创建的共享内存段。
-m, –shmem-id shmid 执行最后一次分离后,删除由shmid标识的共享内存段。
-Q, –queue-key msgkey 移除使用msgkey创建的消息队列。
-q, –queue-id msgid 移除使用msgid标识的消息队列。
-S, –semaphore-key semkey 删除使用semkey创建的信号量。
-s, –semaphore-id semid 删除使用semid标识的信号量。
-h, –help 显示帮助信息。
-V, –version 显示版本信息。
注意事项
在第一个Linux实现中,命令ipcrm使用了弃用语法(旧语法)。之后添加了ipcrm的其他*nix实现中存在的功能,即通过key(不仅仅是标识符)删除资源的能力,以及遵循相同的命令行语法的能力。 为了向后兼容,仍支持以前的语法。
相关手册
ipcmk(1), ipcs(1), msgctl([……]

READ MORE

「ipcs(1)」-

显示有关IPC设施的信息
命令语法格式
ipcs [options]
命令描述
命令ipcs显示有关调用进程具有读访问权限的进程间通信工具的信息。 默认情况下,它显示有关所有三种资源的信息:共享内存段、消息队列、信号量。
命令支持的选项及含义
-i, –id id 仅显示由id标识的一个资源元素的完整详细信息。 此选项需要与三个资源选项之一组合:-m,-q,-s。
-h, –help 显示帮助信息并退出。
-V, –version 显示版本信息并退出。
资源选项
-m, –shmems 写入有关活动共享内存段的信息。
-q, –queues 写入有关活动消息队列的信息。
-s, –semaphores 写入有关活动信号量集的信息。
-a, –all 写入有关这三种资源的信息。这是默认的行为。
输出格式
在这些选项中,只有一个生效:指定的最后一个。
-c, –creator 显示创建者和所有者。
-l, –limits 显示资源限制。
-p, –pid 显示创建者和最后一个操作者的PID。
-t, –time 写入时间信息。 最后一次控制操作的时间,它改变了所有设施的访问权限;消息队列上最后一次msgsnd(2)和msgrcv(2)操作的时间;在共享内存上最后一次shmat(2)和shmdt(2)操作的时间;对信号量进行最后一次semop(2)操作的时间。
-u, –summary 显示状态摘要。
表示方法
这些只影响-l(–limit)选项:
-b, –bytes 以字节单位打印大小。
–human 以可读的格式打印大小。
注意事项
Linux ipcs实用程序与POSIX ipcs实用程序不完全兼容。 Linux版本不支持POSIX -a、-b、-o选项,但支持POSIX未定义的-l、-u选项。可移植应用程序不得使用-a、-b、-o、-l、-u选项。
相关手册
ipcmk(1), ipcrm(1), msgrcv(2), msgsnd(2), semget(2), semop(2), shmat(2), shmdt(2), shmget(2)
参考文献

man 1 ipcs, Version ipcs from util-linux 2.32

更新日志

07/11/2018 创建文章[……]

READ MORE

「isosize(8)」-

输出iso9660文件系统的长度
命令语法格式
isosize [options] iso9660_image_file
命令描述
命令isosize输出“指定文件”中包含的iso9660文件系统的长度。该“指定文件”可以是普通文件或块设备(例如/dev/hdd或/dev/sr0)。
在没有任何选项(和错误)的情况下,它将以字节为单位输出iso9660文件系统的大小。现在这可能是一个很大的数字(>> 4 GB)。
命令支持的选项及含义
-x, –sectors 以易读的形式显示块数量和块大小。输出结果中使用术语“sectors”表示“blocks”。
-d, –divisor number 仅在没有给出-x选项时此选项才有效。如果没有错误,输出的值显示的为:iso9660文件大小(以字节为单位)除以number的结果。因此,如果number是块大小,则显示的值将是块数量。
注意事项
保存iso9660文件系统的文件(或块设备)的大小可能略大于iso9660文件系统的实际大小。其中一个原因是允许CD写入程序在iso9660镜像的结尾添加“run out”扇区。
退出状态
0 执行成功。
1 一般的错误,比如无效的用法。
32 全都失败。
64 部分失败。
参考文献

man 8 isosize, Version isosize from util-linux 2.32
Wikipedia/ISO 9660

更新日志

07/11/2018 创建文章[……]

READ MORE

「kill(1)」-

向进程发送信号
命令语法格式
kill [-signal|-s signal|-p] [-q value] [-a] [–] pid|name…
kill -l [number] | -L
命令描述
命令kill将指定的信号发送到指定的进程或进程组。
如果未指定信号,则发送TERM信号。 此信号的默认操作是终止该过程。 该信号应该优先于KILL信号(编号9)使用,因为进程可以安装TERM信号的处理程序,以便在以有序方式终止之前执行清理步骤。 如果在发送TERM信号之后进程没有终止,则可以使用KILL信号;请注意,后一个信号无法捕获,因此不会使目标进程有机会在终止之前执行任何清理动作。
如果signal为0,则不发送实际信号,但仍执行错误检查。
命令支持的选项及含义
进程列表取值
pid 每个pid可以是以下四种之一:

n,其中n>0。向PID为n的进程发送信号。
0,发信号通知当前进程组中的所有进程。
-1,向PID大于1的所有进程发送信号。
-n,其中n>1。向进程组n中的所有进程发送信号。当给出形式为’-n’的参数,并且它意味着表示一个进程组时,则必须首先指定一个信号,或者必须在参数之前加上’–‘选项,否则kill会将n视为信号。

name 将使用此名称调用的所有进程都将发出信号。
命令可用选项
-s, –signal signal 指定要发送的信号。可以是数字或者信号名。
-l, –list [number] 打印信号名称列表,或将给定的信号编号number转换为名称。 信号可以在/usr/include/linux/signal.h中找到。
-L, –table 与-l类似,但它将打印信号名称及其相应的数字。
-a, –all 不要将“命令名到PID”的转换限制为与当前进程具有相同UID的进程。
-p, –pid 仅打印指定名称的进程的PID,不发送任何信号。
–verbose 打印PID,这些进程将被发送与kill一起的信号。
-q, –queue value 使用sigqueue(3)而不是kill(2)。 参数value是一个与信号一起发送的整数。 如果接收进程使用SA_SIGINFO标志为sigaction(2)安装了此信号的处理程序,则它可以通过siginfo_t结构的si_sigval字段获取此数据。
注意事项
大多数现代Shell都有一个内置的kill命令,其用法与此处描述的命令非常相似。选项–all,–pid,–queue以及通过命令名指定进程的可能性是本地扩展。
尽管可以将多线程进程中的一[……]

READ MORE