「setarch」-

在新的程序环境中修改报告的架构,以及设置个性标志
命令语法格式
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 personality 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.

-B, –32bit

Limit the address space to 32 bits to emulate hardware. Supported on ARM and Alpha. Turns on ADDR_LIMIT[……]

READ MORE

「setsid(1)」-

在新的会话中运行程序
命令语法格式
setsid [options] program [arguments]
命令描述
命令setsid在新会话中运行程序。如果已经是进程组所有者,则该命令调用fork(2)。否则,它在当前进程中执行程序。可以通过–fork选项覆盖此默认行为。
命令支持的选项及含义
-c, –ctty 将控制终端设置为当前终端。
-f, –fork 总是常见一个新的进程。
-w, –wait 等待程序的执行结束,并返回此程序的退出状态作为setsid的返回值。
-V, –version 显示版本信息并退出。
-h, –help 显示帮助信息并退出。
相关手册
setsid(2)
参考文献

man 1 setsid, Version setsid from util-linux 2.32

更新日志

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

READ MORE

「setterm」

setterm用于设置终端的属性。
SYNOPSIS
setterm [options]
DESCRIPTION
setterm writes to standard output a character string that will invoke the specified terminal capabilities. Where possible terminfo is consulted to find the string to use. Some options however (marked “virtual consoles only” below) do not correspond to a terminfo(5) capability. In this case, if the terminal type is “con” or “linux” the string that invokes the specified capabilities on the PC Minix virtual console driver is output. Options that are not implemented by the terminal are ignored.
OPTIONS
For boolean options (on or off), the default is on.
Below, an 8-color can be black, red, green, yellow, blue, magenta, cyan, or white.
A 16-color can be an 8-color, or grey, or bright followed by red, green, yellow, blue, magenta, cyan, or white.
The various color options may be set independently, at least on virtual consoles, though the results of setting multiple modes (for example, –underline and –half-bright) are hardware-dependent.
–appcursorkeys [on|off] (virtual consoles only) Sets Cursor Key Application Mode on or off. When on, ESC O A, ESC O B, etc. will be sent for the cursor keys inst[……]

READ MORE

「sfdisk」-

sfdisk – display or manipulate a disk partition table

命令语法格式

sfdisk [options] device [-N partition-number]

sfdisk [options] command

命令描述

sfdisk is a script-oriented tool for partitioning any block device.

Since version 2.26 sfdisk supports MBR (DOS), GPT, SUN and SGI disk labels, but no longer provides any functionality for CHS (Cylinder-Head-Sector) addressing. CHS has never been important for Linux, and this addressing
concept does not make any sense for new devices.

sfdisk (since version 2.26) aligns the start and end of partitions to block-device I/O limits when relative sizes are specified, when the default values are used or when multiplicative suffixes (e.g MiB) are used for sizes.
It is possible that partition size will be optimized (reduced or enlarged) due to alignment if the start offset is specified exactly in sectors and partition size relative or by multiplicative suffixes.

The recommended way is not to specify start offsets at all and specify partition size in MiB, GiB (or so). In this case sfdisk align all partitions to block-device I/O limits (or when I/O lim[……]

READ MORE

「sulogin(8)」-

单用户登录
命令语法格式
sulogin [options] [tty]
命令描述
当系统进入单用户模式时,程序init会调用sulogin。
用户会被提示:

Give root password for system maintenance
(or type Control-D for normal startup):

如果root帐户被锁定且指定了–force,则不需要密码。
命令sulogin将连接到当前终端,或连接到可在命令行上指定的可选tty设备(通常为/dev/console)。
当用户退出单用户Shell时,或者在提示符处按下Ctrl-D时,系统将继续引导。
命令支持的选项及含义
-e, –force 如果通过getpwnam(3)从系统获取root密码的默认方法失败,则检查/etc/passwd和/etc/shadow以获取密码。如果这些文件已损坏或不存在,或者root帐户被在密码开头的’*’或者“!”锁定,然后sulogin将启动root Shell而不需要密码。
如果您确定控制台在物理上受到保护,并且可以防止未经授权的访问,那么请仅使用-e选项。
-p, –login-shell 指定此选项会导致sulogin作为登录Shell启动shell进程。
-t, –timeout seconds 指定等待用户输入的最长时间。 默认情况下,sulogin会永远等待。
-h, –help 显示帮助信息并退出。
-V, –version 显示版本信息并退出。
相关环境变量
命令sulogin寻找环境变量SUSHELL或sushell来确定要启动的shell。 如果未设置环境变量,它将尝试从/etc/passwd执行root的shell。 如果失败,它将回退到/bin/sh。
参考文献

man 8 sulogin, Version sulogin from util-linux 2.32

更新日志

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

READ MORE

「swaplabel(8)」-

打印或者修改交换区域的标签或UUID
命令语法格式
swaplabel [-L label] [-U UUID] device
命令描述
命令swaplabel将显示或更改位于设备(或常规文件)上的交换分区的标签或UUID。
如果未给出可选参数-L和-U,则swaplabel将仅显示当前交换区域标签和设备的UUID。
如果存在可选参数,则swaplabel将更改设备上的相应值。 也可以在使用mkswap(8)创建交换期间设置这些值。 命令swaplabel允许更改一个激活使用的交换设备标签或UUID。
命令支持的选项及含义
-L, –label label 为设备指定新标签label。标签label最长可达16个字符。 如果label超过16个字符,swaplabel将截断它,并打印一条警告消息。
-U, –uuid UUID 为设备指定新的UUID。 UUID必须采用标准的8-4-4-4-12字符格式,例如由uuidgen(1)输出。
-h, –help 显示帮助信息并退出。
相关环境变量
LIBBLKID_DEBUG=all 启用libblkid的调试输出。
相关手册
uuidgen(1), mkswap(8), swapon(8)
参考文献

man 8 swaplabel, Version swaplabel from util-linux 2.32

更新日志

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

READ MORE

「swapoff(8)」-

禁用用于分页和交换的设备和文件
命令描述
命令swapoff禁用指定的设备和文件的交换。当给出-a标志时,禁用所有已知的交换设备和文件上的交换(如/proc/swaps或/etc/fstab中所示)。
详细的使用方法参考swapon(8)手册。
参考文献

man 8 swapon, Version swapon from util-linux 2.32

更新日志

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

READ MORE

「swapon(8)」-

启用/禁用用于分页和交换的设备和文件
命令语法格式
swapon [options] [specialfile…]
swapoff [-va] [specialfile…]
命令描述
命令swapon用于指定要进行分页和交换的设备。
由参数specialfile给出使用的设备或文件。它可以是-L label或-U uuid形式,来用于通过label或uuid来指示设备。
对swapon的调用通常发生在系统启动脚本中,使所有交换设备可用,因此分页和交换活动在多个设备和文件之间交错。
命令swapoff禁用指定的设备和文件的交换。当给出-a标志时,禁用所有已知的交换设备和文件上的交换(如/proc/swaps或/etc/fstab中所示)。
命令支持的选项及含义
启用交换分区
-a, –all 将所有在/etc/fstab中标记为“swap”设备设为可用,除了那些带有“noauto”选项的。 静默跳过已用作交换的设备。
-e, –ifexists 默默地跳过不存在的设备。 /etc/fstab挂载选项nofail也可用于跳过不存在的设备。
-L label 使用具有指定标签label的分区来作为交换分区。(为此,需要访问/proc/partitions。)
-U uuid 通过uuid指定要使用的分区。
-d, –discard[=policy] 如果交换后备设备支持丢弃或修整操作,则启用交换丢弃。 这可能会提高某些固态设备的性能,但通常不会。 该选项允许用户在两个可用的交换丢弃策略之间进行选择:

–dispard=once,在swapon时,对整个交换区域执行单次丢弃操作;
–discard=pages,在可以重用之前,异步丢弃释放的交换页面。

如果未选择任何策略,则默认行为是启用两种丢弃类型。 /etc/fstab挂载选项discard,discard=once,discard=pages也可用于启用discard标志。
-f, –fixpgsz 如果交换空间的页面大小与当前运行的内核的大小不匹配,则重新初始化(exec mkswap)。调用mkswap(2)初始化整个设备,不检查坏块。
-o, –options opts 通过fstab兼容的逗号分隔字符串指定交换选项。 例如:swapon -o pri=1,discard=pages,nofail /dev/sda2,评估最后的opts字符串,并覆盖所有其他命令行选项。
-p, –priority priority 指定交换设备的优先级。 priority是介于-1和32767之间的值。数字越大表示优先级越高。[……]

READ MORE

「switch_root(8)」-

切换到另一个文件系统作为挂载树的根目录
命令语法格式
switch_root [-hV]
switch_root newroot init [arg…]
命令描述
命令switch_root移动已经挂载/proc,/dev,/sys,/run文件系统到newroot下,并使newroot成为新的根文件系统,并启动init进程。
警告:命令switch_root会递归删除当前根文件系统上的所有文件和目录。
命令支持的选项及含义
-h, –help 显示帮助信息并退出。
-V, –version 显示版本信息并退出。
注意事项
如果newroot不是挂载的根目录,switch_root将无法运行。 如果要将root切换到不符合此要求的目录,则可以先使用“绑定挂载”技巧将任何目录转换为挂载点:mount –bind $DIR $DIR
退出状态
0 成功;
1 失败;
相关手册
chroot(2), init(8), mkinitrd(8), mount(8)
参考文献

man 8 switch_root, Version switch_root from util-linux 2.32

更新日志

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

READ MORE

「taskset(1)」-

设置或检索进程的CPU亲和性
命令语法格式
taskset [options] mask command [argument…]
taskset [options] -p [mask] pid
命令描述
命令taskset用于在给定pid的情况下设置或检索正在运行的进程的CPU亲和性,或者用于启动具有给定CPU亲和性的新命令。 CPU亲和性是一种调度程序属性,它将进程“绑定”到系统上的给定CPU集。 Linux调度程序将遵循给定的CPU亲和性,并且该进程不会在任何其他CPU上运行。请注意,Linux调度程序还支持自然CPU亲和性:由于性能原因,调度程序会尝试将进程保留在同一CPU上。因此,强制特定的CPU亲和性仅在某些应用程序中有用。
CPU亲和性表示为位掩码,最低位对应于第一逻辑CPU,最高位对应于最后一个逻辑CPU。并非所有CPU都可能存在于给定系统上,但掩码可能指定的CPU数量多于现有CPU数量。检索到的掩码将仅反映与系统上物理上的CPU相对应的位。如果给出了无效掩码(即,对应于当前系统上没有有效CPU的掩码),则返回错误。掩码可以用十六进制指定(带或不带前导“0x”),或带有–cpu-list选项的CPU列表。例如:

0x00000001,处理器#0,
0x00000003,处理器#0和#1,
0xFFFFFFFF,处理器#0~#31,
32,处理器#0、#4、#5,
–cpu-list 0-2,6,处理器#0、#1、#2、#6

当taskset返回时,保证给定的程序已被安排到合法的CPU。
命令支持的选项及含义
-a, –all-tasks 设置或检索给定PID的所有任务(线程)的CPU亲和性。
-c, –cpu-list 将mask解释为处理器的数字列表,而不是位掩码。 数字以逗号分隔,可能包括范围。 例如:0,5,8-11。
-p, –pid 在现有PID上运行,不要启动新任务。
-h, –help 显示帮助信息。
-V, –version 显示版本信息。
注意事项
权限
用户可以更改属于同一用户的进程的CPU亲和性。 用户必须拥有CAP_SYS_NICE才能更改属于另一个用户的进程的CPU亲和性。 用户可以检索任何进程的关联掩码。
使用示例
默认行为是使用给定的关联掩码运行新命令:

# taskset mask command [arguments]

您还可以检索现有任务的CPU亲和性:

# taskset -p pid

或者设置:

# taskse[……]

READ MORE

「terminal-colors.d」-

terminal-colors.d – Configure output colorization for various utilities
命令语法格式
/etc/terminal-colors.d/[[name][@term].][type]
命令描述

Files in this directory determine the default behavior for utilities when coloring output.

The name is a utility name. The name is optional and when none is specified then the file is used for all unspecified utilities.

The term is a terminal identifier (the TERM environment variable). The terminal identifier is optional and when none is specified then the file is used for all unspecified terminals.

The type is a file type. Supported file types are:

disable Turns off output colorization for all compatible utilities.

enable Turns on output colorization; any matching disable files are ignored.

scheme Specifies colors used for output. The file format may be specific to the utility, the default format is described below.

If there are more files that match for a utility, then the file with the more specific filename wins. For example, the filename “@xterm.scheme” has less priority than “dmesg@xterm.scheme”. The lowest priority are those fi[……]

READ MORE

「ul(1)」-

do underlining
命令语法格式
ul [-i] [-t terminal] [file …]
命令描述
命令ul读取命名文件(或标准输入,如果没有给出),并将下划线的出现转换为序列,该序列指示正在使用的终端的下划线,由环境变量TERM指定。 读取文件/etc/termcap以确定用于下划线的适当序列。
如果终端不能加下划线,但能够具有突出模式,则使用该终端。 如果终端可以重击,或自动处理下划线,则ul退化为cat(1)。 如果终端不能加下划线,则忽略下划线。
在翻译过程中,其他一些特殊字符也会被翻译。例如,TAB扩展到空间。
命令支持的选项及含义
-i 下划线由包含适当破折号“-”的单独行表示;当您想要查看CRT终端上的nroff(1)输出流中存在的下划线时,这非常有用。
-t terminal 使用terminal覆盖环境中指定的终端类型。
注意事项
命令nroff(1)通常输出一系列退格和下划线与文本混合以指示下划线。 没有尝试优化后向移动。
相关环境变量
LANG, LC_ALL, LC_CTYPE, TERM 这些环境变量会影响ul的执行。参考environ(7)手册。
退出状态
0 成功
>0 失败
使用示例
在终端中执行如下两个命令并观察输出:

# echo $’hello k\b_i\b_t\b_t\b_y\b_ world’ | ul
# echo $’hello k\b_i\b_t\b_t\b_y\b_ world’

第一个命令会以带有下划线的形式输出kitty单词。
相关手册
colcrt(1), man(1), nroff(1)
参考文献

man 1 ul, Version 9.0.12
How to use the ul command line utility

更新日志

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

READ MORE

「umount(8)」-

卸载文件系统
命令语法格式
umount -a [-dflnrv] [-t fstype] [-O option…]
umount [-dflnrv] {directory|device}…
umount -h | -V
命令描述
命令umount将提到的文件系统与文件层次结构分离。 通过给出已挂载目录的目录来指定文件系统。 给文件系统所在的特殊设备也可以使用,但是已经过时,主要是因为如果该设备挂载在多个目录上,它将会失败。
请注意,文件系统在“busy”时无法卸载 – 例如,当文件系统上有打开的文件,或者某个进程在其中有工作目录时,或者正在使用其中的交换文件时。 违规进程甚至可以自行卸载 – 它会打开libc,而libc可能会打开例如locale文件。 懒惰卸载(–lazy)可以避免这个问题。
命令支持的选项及含义
-a, –all 除了proc,devfs,devpts,sysfs,rpc_pipefs,nfsd文件系统之外,卸载/proc/self/mountinfo(或弃用的/ etc/mtab)中描述的所有文件系统。此文件系统列表可以替换为–types umount选项。
-A, –all-targets 卸载指定文件系统的当前命名空间中的所有挂载点。 文件系统可以由其中一个挂载点或设备名称(或UUID等)指定。 当此选项与–recursive一起使用时,文件系统中的所有嵌套挂载都将以递归方式卸载。
仅在/etc/mtab是/proc/mounts的符号链接的系统上支持此选项。
-c, –no-canonicalize 不要规范化路径。 路径规范化基于stat(2)和readlink(2)系统调用。 在某些情况下,这些系统调用可能会挂起(例如在NFS上如果服务器不可用)。 该选项必须与挂载点的规范路径一起使用。
有关此选项的更多详细信息,请参见mount(8)手册页。 请注意,umount不会将此选项传递给/sbin/umount.type帮助程序。
-d, –detach-loop 当卸载的设备是环路设备时,也可以释放此环路设备。 对于mount(8)初始化的设备,此选项是不必要的,在这种情况下,默认情况下启用“autoclear”功能。
–fake 除了实际的系统调用或umount帮助程序执行外,导致一切都要完成;这个’伪造’卸载文件系统。 它可用于从已弃用的/etc/mtab中删除条目(先前使用-n选项卸载的)。
-n, –no-mtab 无需在/etc/mtab中写入即可卸载。
-f, –force 强制卸载(如果无法访问NFS系统)。
请注意,此选项不保证umount命令不会挂起。[……]

READ MORE

「uname26」-

sadsadas[……]

READ MORE

「unshare」-

unshare – run program with some namespaces unshared from parent

命令语法格式

unshare [options] [program [arguments]]

命令描述

Unshares the indicated namespaces from the parent process and then executes the specified program. If program is not given, then “${SHELL}” is run (default: /bin/sh).

The namespaces can optionally be made persistent by bind mounting /proc/pid/ns/type files to a filesystem path and entered with nsenter(1) even after the program terminates (except PID namespaces where permanently running
init process is required). Once a persistent namespace is no longer needed, it can be unpersisted with umount(8). See the EXAMPLES section for more details.

The namespaces to be unshared are indicated via options. Unshareable namespaces are:

mount namespace

Mounting and unmounting filesystems will not affect the rest of the system, except for filesystems which are explicitly marked as shared (with mount –make-shared; see /proc/self/mountinfo or findmnt -o+PROPAGATION
for the shared flags). For further details, see mount_namespaces(7) and the discussion of the CLONE_NEWNS flag in clone[……]

READ MORE

「utmpdump(1)」-

以原始格式转储UTMP和WTMP文件
命令语法格式
utmpdump [options] [filename]
命令描述
命令utmpdump是一个以原始格式转储UTMP和WTMP文件的简单程序,因此可以检查它们的内容。命令utmpdump从标准输入读取,除非传递filename参数。
命令支持的选项及含义
-f, –follow 随着文件的增长输出被追加的数据。类似于tail(1)的-f选项。
-o, –output file 将命令的输出写入file,而不是标准输出。
-r, –reverse 非转储,而是将编辑后的登录信息写回utmp或wtmp文件。
-V, –version 显示版本信息并退出。
-h, –help 显示帮助信息并退出。
注意事项
在utmp或wtmp条目损坏的情况下,命令utmpdump非常有用。 它可以将utmp/wtmp转储到ASCII文件中,然后可以对其进行编辑以删除虚假条目,并使用以下命令重新集成:

# utmpdump -r < ascii_file > wtmp

但请注意,utmpdump仅用于调试目的。
文件格式
手册utmp(5)的唯一二进制版本是标准化的。文本转储可能在将来变得不兼容。
版本2.28是使用ctime(3)时间戳格式打印文本输出的最后一个版本。较新的转储使用UTC-0时区中的毫秒精度ISO-8601时间戳格式。 从以前的时间戳格式转换可以制成二进制,但尝试这样做会导致时间戳漂移时区偏移量。
注意事项
您可能不使用-r选项,因为utmp/wtmp文件的格式很大程度上取决于输入格式。 此工具不是为正常使用而编写的,而是仅用于调试。
相关手册
last(1), w(1), who(1), utmp(5)
参考文献

man 1 utmpdump, Version utmpdump from util-linux 2.32

更新日志

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

READ MORE

「uuidd(8)」-

UUID生成守护进程
命令语法格式
uuidd [options]
命令描述
uuidd守护程序被UUID库用于生成通用唯一标识符(UUID),尤其是基于时间的UUID,以安全且保证唯一的方式生成,即使面对在不同CPU上运行的大量线程试图获取UUID。
命令支持的选项及含义
-n, –uuids number 向正在运行的uuidd发出测试请求时,请求批量响应number个UUID。
-t, –time 测试uuidd,通过尝试连接到正在运行的uuidd守护程序,并请求它返回“基于时间”的UUID来。
-r, –random 测试uuidd,通过尝试连接到正在运行的uuidd守护程序,并请求它返回“基于随机”的UUID来。
前台运行及守护进程
-F, –no-fork 不要使用双分叉进行守护进程化。
-P, –no-pid 不要创建pid文件。
-S, –socket-activation 不要创建套接字,而是期望它由调用进程提供。 该选项隐含了–no-fork和–no-pid选项。 此选项仅适用于systemd(1)。 需要使用configure选项启用它。
-p, –pid path 指定应写入pid文件的路径名。 默认情况下,pid文件将写入/run/uuidd/uuidd.pid。
-s, –socket path 使uuidd将此path名用于unix-domain套接字。 默认情况下,使用的路径名是/run/uuidd/request。 此选项主要用于调试目的,因为路径名在libuuid库中是硬编码的。
-k, –kill 如果当前正在运行uuidd守护程序,请将其终止。
-T, –timeout number 在数秒不活动后让uuidd退出。
调试信息
-q, –quiet 抑制一些失败消息。
-d, –debug 在调试模式下运行uuidd。 这可以防止uuidd作为守护进程运行。
其他选项
-h, –help 显示帮助信息。
-V, –version 显示版本信息。
使用示例
启动一个守护进程,打印42个随机密钥,然后停止守护进程:

# uuidd -p /tmp/uuidd.pid -s /tmp/uuidd.socket
# uuidd -d -r -n 42 -s /tmp/uuidd.socket
# uuidd -d -k -s /tmp/uuidd.socket

如上示例。
相关手册
uuid(3), uuidgen(1)
参考文献

man 8[……]

READ MORE

「uuidgen(1)」-

创建一个新的UUID值
命令语法格式
uuidgen [options]
命令描述
命令uuidgen程序使用libuuid(3)库创建(并打印)一个新的通用唯一标识符(UUID)。在本地系统上创建的所有UUID中,以及在其他系统上创建的UUID中,新的UUID可以合理地被认为是唯一的,无论是过去和未来。
命令uuidgen可以生成两种类型的UUID:

基于时间的UUID;
基于随机的UUID。

默认情况下,如果存在高质量的随机数生成器,uuidgen将生成基于随机的UUID。 否则,它将选择基于时间的UUID。 可以使用-r或-t选项强制生成这两种UUID类型之一。
命令支持的选项及含义
-r, –random 生成基于随机的UUID。 此方法创建一个主要由随机位组成的UUID。 它要求操作系统具有高质量的随机数生成器,例如/dev/random。
-t, –time 生成基于时间的UUID。 此方法根据系统时钟和系统的以太网硬件地址(如果存在)创建UUID。
-h, –help 显示帮助信息。
-V, –version 显示版本信息。
符合标准
OSF DCE 1.1
相关手册
libuuid(3)
参考文献

man 1 uuidgen, Version uuidgen from util-linux 2.29.2

更新日志

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

READ MORE

「wall(1)」-

向所有用户写入消息
命令语法格式
wall [-n] [-t timeout] [message | file]
命令描述
命令wall用于在所有当前登录用户的终端上显示消息、文件内容,或其标准输入。该命令将包含长度超过79个字符的行。小于时是用空格填充的,达到79个字符。 该命令将始终在每行的末尾放置一个回车符和换行符。
只有超级用户才能在已选择拒绝邮件或正在使用自动拒绝邮件的程序的用户的终端上写入消息。
当调用者不是超级用户,并且程序是SUID或SGID时,拒绝从文件file中读取。
命令行选项
-n, –nobanner 取消消息横幅,只发送消息内容。
-t, –timeout timeout 在timeout秒后,放弃对终端的写入尝试。参数timeout必须是正整数。默认值为300秒,这是人们通过调制解调器线路运行终端时的遗留问题。
-g, –group group 使用group参数指定一个组,消息只会发送给该组中的成员。参数可以是GID或者组名。
其他选项
–help 显示帮助信息并退出。
–version 显示版本信息并退出。
注意事项
某些会话,例如wdm,在utmp(5)的ut_type数据的开头有一个’:’字符,不会从wall上获取消息。 这样做是为了避免写入错误。
使用示例
执行如下命令:

# wall “This is a message.”

在每个用户的登录终端中将收到如下消息:

Broadcast message from root@laptop (pts/16) (Wed Jan 23 08:10:57 2019):

This is a message.

使用-n选项,可以取消发送消息横幅(即,Broadcast message …)
相关手册
mesg(1), talk(1), write(1), shutdown(8)
参考文献

man 1 wall, Version wall from util-linux 2.29.2

更新日志

07/11/2018 创建文章
01/23/2019 调整文章内容,加入「使用示例」部分[……]

READ MORE

「wdctl(8)」-

显示硬件看门狗状态
命令语法格式
wdctl [options] [device…]
命令描述
显示硬件看门狗状态。 默认设备是/dev/watchdog。 如果指定了多个设备,则输出将由一个空行分隔。
请注意,支持的监视程序功能的数量是特定于硬件的。
命令支持的选项及含义
-f, –flags list 仅打印指定的标志。
-F, –noflags 不要打印有关标志的信息。
-I, –noident 不要打印看门狗身份信息。
-n, –noheadings 不要为标志表打印标题行。
-o, –output list 定义要在监视标志表中使用的输出列。 如果未指定输出排列,则使用默认设置。 使用–help获取所有支持列的列表。
-O, –oneline 以key=“value”输出格式在一行上打印所有想要的信息。
-r, –raw 使用原始的输出格式。
-s, -settimeout seconds 以秒为单位,设置监视程序超时。
-T, –notimeouts 不要打印看门狗超时。
-x, –flags-only 等价于-I -T组合。
-V, –version 显示版本信息并退出。
-h, –help 显示帮助信息并退出。
参考文献

man 8 wdctl, Version wdctl from util-linux 2.32

更新日志

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

READ MORE

「whereis(1)」-

定位命令的二进制文件、源码、手册文件的位置
命令语法格式
whereis [options] [-BMS directory… -f] name…
命令描述
命令whereis查找指定命令name的二进制文件、源文件、手册文件。
对于提供的参数name,首先会被剥离了其前导路径名组件,以及形如.ext的任何尾随扩展名(单个扩展名),只保留前缀。由于使用源代码控制而导致的问题也得到了解决。然后尝试在标准Linux位置以及$PATH和$MANPATH指定的位置找到所需的程序。
搜索限制(选项-b,-m,-s)是累积的,并应用于命令行上的后续name模式。任何新的搜索限制都会重置搜索掩码。 例如:

# whereis -bm ls tr -m gcc

上面的命令搜索“ls”和“tr”二进制文件和手册页,以及仅仅搜索“gcc”手册页。
选项-B、-M、-S重置后续名称模式的搜索路径。 例如:

# whereis -m ls -M /usr/share/man/man1 -f cal

在所有默认路径中搜索“ls”手册页,但仅在/usr/share/man/man1目录中搜索“cal”。
命令支持的选项及含义
-b 搜索二进制文件。
-m 搜索手册。
-s 搜索源文件。
-B list 参数list是以空格分隔的目录列表,限制whereis搜索二进制文件的位置。
-M list 参数list是以空格分隔的目录列表,限制whereis搜索手册的位置。
-S list 参数list是以空格分隔的目录列表,限制whereis搜索源文件的位置。
-f 在使用任何-B、-M、-S选项时,必须使用该选项。该选项表示目录列表终止,并指出文件名name的开始。
-u 仅显示具有异常条目的命令名称。如果每个显式请求的类型不是只有一个条目,则称该命令是异常的。 因此’whereis -m -u *’要求当前目录中没有文档文件或有多个的文件。
-l 输出whereis正在使用的有效查找路径列表。如果未指定-B、-M、-S,则该选项将输出命令能够在系统上找到的硬编码路径。
–help 显示帮助信息并退出。
–version 显示版本信息并退出。
文件搜索路径
默认情况下,命令whereis尝试从使用通配符模式定义的硬编码路径中查找文件。该命令尝试将$PATH和$MANPATH环境变量的内容用作默认搜索路径。
了解正在使用的路径的最简单方法是使用-l选项。使用-l显示-B、-M、-S选项的效果。
使用示例
要查找/usr/bin中那些未记录在[……]

READ MORE

「wipefs」-

wipefs – wipe a signature from a device

命令语法格式

wipefs [options] device…

wipefs [–backup] -o offset device…

wipefs [–backup] -a device…

命令描述

wipefs can erase filesystem, raid or partition-table signatures (magic strings) from the specified device to make the signatures invisible for libblkid. wipefs does not erase the filesystem itself nor any other data from
the device.

When used without any options, wipefs lists all visible filesystems and the offsets of their basic signatures. The default output is subject to change. So whenever possible, you should avoid using default outputs in your
scripts. Always explicitly define expected columns by using –output columns-list in environments where a stable output is required.

wipefs calls the BLKRRPART ioctl when it has erased a partition-table signature to inform the kernel about the change.

Note that some filesystems and some partition tables store more magic strings on the device (e.g. FAT, ZFS, GPT). The wipefs command (since v2.31) lists all the offset where a magic strings have been detected.[……]

READ MORE

「write(1)」-

向其他用户发送消息
命令语法格式
write user [ttyname]
命令描述
命令write允许您与其他用户进行通信,通过从终端复制到他们的线路。
当您运行write命令时,接收消息的用户将获得以下格式的消息:

Message from yourname@yourhost on yourtty at hh:mm …

您输入的任何其他行将被复制到指定用户的终端。如果其他用户想要回复,他们也必须运行write。
完成后,键入文件结束(EOF)或中断字符。其他用户将看到消息EOF,表明对话已结束。
您可以使用mesg(1)命令阻止其他人(超级用户除外)向您发送消息。某些命令(例如nroff(1)和pr(1))可能会禁止自动写入,因此不会覆盖输出。
如果要收信的用户登录到多个终端,则可以通过将终端名称指定为write命令的第二个操作数来指定要写入的终端。或者,您可以让write选择其中一个终端 – 它将选择空闲时间最短的终端。这样,如果用户在工作时登录并从家中拨打,则该消息将转到正确的位置。
发信给某人的传统协议是字符串“-o”,无论是在一行的末尾还是独自在一行上,都意味着它是另一个人可以说话的。字符串“oo”表示该人认为会话已结束。
相关手册
mesg(1), talk(1), who(1)
参考文献

man 1 write, Version 9.0.12

更新日志

09/01/2018 创建文章[……]

READ MORE

「x86_64(8)」-

在新的程序环境中修改报告的架构,以及设置个性标志
命令描述
该命令为指向setarch(8)的符号链接。用于修改当前环境uname -m的输出,使其为“x86_64”。
相关内容参考手册setarch(8)中的说明。
参考文献

man 8 setarch, Version setarch from util-linux 2.32

更新日志

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

READ MORE

「zramctl」-

zramctl – set up and control zram devices

命令语法格式

Get info:

zramctl [options]

Reset zram:

zramctl -r zramdev…

Print name of first unused zram device:

zramctl -f

Set up a zram device:

zramctl [-f | zramdev] [-s size] [-t number] [-a algorithm]

命令描述

zramctl is used to quickly set up zram device parameters, to reset zram devices, and to query the status of used zram devices.

If no option is given, all non-zero size zram devices are shown.

命令支持的选项及含义

-a, –algorithm lzo|lz4|lz4hc|deflate|842

Set the compression algorithm to be used for compressing data in the zram device.

-f, –find

Find the first unused zram device. If a –size argument is present, then initialize the device.

-n, –noheadings

Do not print a header line in status output.

-o, –output list

Define the status output columns to be used. If no output arrangement is specified, then a default set is used. Use –help to get a list of all supported columns.[……]

READ MORE

「which」

Which包中只包含了一个which命令,该命令用于定位某个命令的路径。
安装
从发行版的源中安装

#!/bin/bash

# Kali GNU/Linux Rolling
apt-get install debianutils

# 不同的发行版中包含which命令的包有不同的名字。

使用源码编译安装
参考BLFS中的说明:BLFS/Which-2.21 and Alternatives: http://www.linuxfromscratch.org/blfs/view/7.10/general/which.html
安装的可执行程序
which 定位命令,显示在PATH中的命令的全路径。[……]

READ MORE

「which(1)」-

定位一个命令
命令语法格式
which [-a] filename …
命令描述
命令which返回参数filename在当前环境中的执行文件(或链接)的路径名,参数filename在严格POSIX兼容的Shell中作为命令给出。
它通过搜索环境变量PATH来寻找匹配参数filename的可执行文件。它不会规范的路径名。
命令支持的选项及含义
-a 打印每个参数的所有匹配的路径名。默认情况下,只会返回第一个匹配的路径。使用该选项后则会返回所有匹配路径名。
注意事项
命令which的实现众多,本手册所说的which只是debianutils包中的which。
退出状态
0 找到了所有的命令,并且可执行。
1 一个或多个命令未找到或者不可执行。
2 指定了无效的选项。
使用示例
如下示例,查找mkdir命令的位置:

# which mkdir
/bin/mkdir

输出/bin/mkdir表示当你执行mkdir时,执行的是/bin下的mkdir命令。但是这不是绝对的,看下面的示例:

# which ls
/bin/ls

但,当在shell里执行ls时,实际上执行的是ls -a -CF –color=auto,因为我们之前定义了alias ls=’ls -a -CF –color=auto’。
命令which通常可以用于判断系统里是否有某个命令,并获取它的绝对路径。可以用type(shell的内建命令)命令来判断当前执行的实际命令。
参考文献

BLFS/Which-2.21 and Alternatives
GNU/which
man 1 whcih, version debianutils 4.8.4

更新日志

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

READ MORE

「2z.wireless tools」

Wireless Extension(WE)是Linux Kernel中的通用API,允许驱动程序公开特定于通用的无线LAN的配置和统计信息到用户空间。只要驱动程序支持Wireless Extension,工具就可以支持各种类型的(Wireless LAN),无论其是什么类型。 WE参数也可以随时更改,而无需重新启动驱动程序(或Linux)。
Wireless Tools(WT),是包含一组允许操纵Wireless Extension的工具,使用文本界面来操作。
安装
从发行版的源中安装

#!/bin/bash

# Kali GNU/Linux Rolling
apt-get install wireless-tools

使用源码编译安装 参考BLFS/Wireless Tools-29: http://www.linuxfromscratch.org/blfs/view/7.10/basicnet/wireless_tools.html
安装的可执行程序
ifrename renames network interfaces based on various static criteria.
iwconfig configures a wireless network interface.
iwevent displays wireless events generated by drivers and setting changes.
iwgetid reports ESSID, NWID or AP/Cell Address of wireless networks.
iwlist 获取无线接口的详细信息。
iwpriv configures optional (private) parameters of a wireless network interface.
iwspy gets wireless statistics from specific node.
参考文献

BLFS / Wireless Tools-29: http://www.linuxfromscratch.org/blfs/view/7.10/basicnet/wireless_tools.html
Wireless Tools Homepage: http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html[……]

READ MORE

「iw」

参考文献

About iw:https://wireless.wiki.kernel.org/en/users/Documentation/iw[……]

READ MORE

「iwlist」

iwlist,获取无线接口的某些附加的信息,这些信息是iwconfig(8)所显示不了的。
命令行语法及含义
iwlist [interface] scanning iwlist [interface] frequency iwlist [interface] rate iwlist [interface] keys iwlist [interface] power iwlist [interface] txpower iwlist [interface] retry iwlist [interface] event iwlist [interface] auth iwlist [interface] wpakeys iwlist [interface] genie iwlist [interface] modulation iwlist –help iwlist –version
主要参数用于选择要显示的信息类别,iwlist以详细的形式显示与此类别相关的所有信息,包括iwconfig(8)已显示的信息。
命令选项及含义
scan[ning] Give the list of Access Points and Ad-Hoc cells in range, and optionally a whole bunch of information about them (ESSID, Quality, Frequency, Mode…). The type of information returned depends on what the card supports. Triggering scanning is a privileged operation (root only) and normal users can only read left-over scan results. By default, the way scanning is done (the scope of the scan) is dependant on the card and card settings. This command takes optional arguments, however most drivers will ignore those. The option essid is used to specify a scan on a spe‐ cific ESSID. With some card/driver, this enables to see hidden net‐ works. The option last does not trigger a scan and read left-over[……]

READ MORE