Relative Content

LINUX MANUAL PAGES

category

「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

「last(1)」-

显示上次登录用户列表
命令语法格式
last [options] [username…] [tty…]
lastb [options] [username…] [tty…]
命令描述
命令last搜索/var/log/wtmp文件(或-f选项指定的文件),并显示自该文件创建以来登录(和退出)的所有用户的列表。 可以给出一个或多个用户名或ttys,在这种情况下,last将仅显示与这些参数匹配的条目。参数ttys的名称可以缩写,因此last 0与last tty0相同。
当捕获SIGINT信号(由中断键产生,通常是control-C)或SIGQUIT信号时,last将显示它在文件中已经搜索的距离;在SIGINT信号的情况下,last将终止。
每次重启系统时,伪用户重启都会记录。 因此,last reboot将显示自创建日志文件以来所有重新启动的日志。
命令lastb与last相同,但默认情况下它显示/var/log/btmp文件的日志,其中包含所有错误的登录尝试。
命令支持的选项及含义
-f, –file file 告诉last使用特定文件而不是/var/log/wtmp。可以多次给出–file选项,会处理所有指定的文件。
-number, -n, –limit number 告诉last要显示多少行。
主机名
-a, –hostlast 在最后一列中显示主机名。 与–dns选项结合使用很有用。
-d, –dns 对于非本地登录,Linux不仅存储远程主机的主机名,还存储其IP地址。 此选项将IP地址转换回主机名。
-i, –ip 与–dns一样,但显示主机的IP号而不是名称。
-R, –nohostname 禁止显示主机名字段。
时间范围
-F, –fulltimes 打印完整登录和注销时间和日期。
-p, –present time 显示在指定时间出现的用户。这就像同时使用选项–since和–until一样。
-s, –since time 显示自指定时间以来的登录状态。 例如,这很容易确定谁在特定时间登录。 该选项通常与–until结合使用。
-t, –until time 显示登录状态,直到指定时间。
–time-format format 将输出时间戳格式定义为:notime,short,full,iso之一。notime变量根本不打印任何时间戳;short是默认值;full与–fulltimes选项相同;iso变量将以ISO-8601格式显示时间戳。ISO格式包含时区信息,因此在系统外部调查打印输出时更为可取。
其他信息
-w, –[……]

READ MORE

「lastb(1)」-

显示上次登录用户列表
命令描述
参考last(1)手册。
参考文献

man 1 lastb, Version 2.32.1-0.1

更新日志

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

READ MORE

「lsblk」

lsblk,以树形结构显示块设备的信息。

lsblk lists information about all available or the specified block devices. The lsblk
command reads the sysfs filesystem and udev db to gather information.

The command prints all block devices (except RAM disks) in a tree-like format by
default. Use lsblk –help to get a list of all available columns.

The default output, as well as the default output from options like –fs and –topol‐
ogy, is subject to change. So whenever possible, you should avoid using default out‐
puts in your scripts. Always explicitly define expected columns by using –output
columns-list in environments where a stable output is required.

Note that lsblk might be executed in time when udev does not have all information
about recently added or modified devices yet. In this case it is recommended to use
udevadm settle before lsblk to synchronize with udev.

命令行语法格式

lsblk [options] [device…]

命令行支持的选项及含义

-a, –all

Also list empty devices. (By default they are skipped.)

-b, –bytes

Print the SIZE column in bytes rather than in a human-re[……]

READ MORE

「lscpu」-

功能简述
lscpu – display information about the CPU architecture
常用命令
查看 CPU 信息

# lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
Address sizes: 39 bits physical, 48 bits virtual
CPU(s): 4
On-line CPU(s) list: 0-3
Thread(s) per core: 2
Core(s) per socket: 2
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 60
Model name: Intel(R) Core(TM) i7-4600M CPU @ 2.90GHz
Stepping: 3
CPU MHz: 1370.629
CPU max MHz: 3600.0000
CPU min MHz: 800.0000
BogoMIPS: 5786.49
Virtualization: VT-x
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 4096K
NUMA node0 CPU(s): 0-3
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss
ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni
pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic[……]

READ MORE

「lslocks」-

NAME

lslocks – list local system locks

命令语法格式

lslocks [options]

命令描述

lslocks lists information about all the currently held file locks in a Linux system.

命令支持的选项及含义

-i, –noinaccessible

Ignore lock files which are inaccessible for the current user.

-J, –json

Use JSON output format.

-n, –noheadings

Do not print a header line.

-o, –output list

Specify which output columns to print. Use –help to get a list of all supported columns.

The default list of columns may be extended if list is specified in the format +list (e.g. lslocks -o +BLOCKER).

-p, –pid pid

Display only the locks held by the process with this pid.

-r, –raw

Use the raw output format.

-u, –notruncate

Do not truncate text in columns.

-V, –version

Display version information and exit.

-h, –help

Display help text and exit.

OUTPUT

COMMAND

The command name of the process holding the lock.

PID[……]

READ MORE

「lslogins」-

lslogins – display information about known users in the system

命令语法格式

lslogins [options] [-s|-u[=UID]] [-g groups] [-l logins]

命令描述

Examine the wtmp and btmp logs, /etc/shadow (if necessary) and /etc/passwd and output the desired data.

The default action is to list info about all the users in the system.

命令支持的选项及含义

Mandatory arguments to long options are mandatory for short options too.

-a, –acc-expiration

Display data about the date of last password change and the account expiration date (see shadow(5) for more info). (Requires root privileges.)

–btmp-file path

Alternate path for btmp.

-c, –colon-separate

Separate info about each user with a colon instead of a newline.

-e, –export

Output data in the format of NAME=VALUE.

-f, –failed

Display data about the users’ last failed login attempts.

-G, –supp-groups

Show information about supplementary groups.

-g, –groups=groups

Only show data of users belonging to groups. More than one group[……]

READ MORE

「mcookie(1)」-

为xauth生成cookie
命令语法格式
mcookie [options]
命令描述
命令mcookie生成一个128位随机十六进制数,用于X权限系统。 典型用法:

# xauth add :0 . `mcookie`

生成的“随机”数实际上是按优先顺序来自源getrandom()系统调用,/dev/urandom,/dev/random,libc伪随机函数之一的随机信息的MD5消息摘要。 另请参见–file选项。
命令支持的选项及含义
-f, –file file 使用此file作为附加的随机源(例如/dev/urandom)。 当file为’-‘时,从标准输入读取字符。
-m, –max-size number 仅从file中读取此字节数。从文件或设备读取其他随机性时,可以使用该选项。
参数number可以跟随乘法后缀: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等。
-v, –verbose 通知何处产生随机性,以及通过从每个源读取的熵量。
-V, –version 显示版本信息并退出。
-h, –help 显示帮助信息并退出。
注意事项
假设没有任何随机源会阻塞。
相关文件
/dev/urandom, /dev/random 随机数源。
相关手册
md5sum(1), X(1), xauth(1), rand(3)
参考文献

man 1 mcookie, Version mcookie from util-linux 2.32

更新日志

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

READ MORE

「mesg(1)」-

显示(或者屏蔽)来自其他用户的消息
命令语法格式
mesg [option] [n|y]
命令描述
命令mesg由用户来调用,用于控制其他人对与标准错误关联的终端设备的写入访问。如果用户允许写访问,则其他用户可以通过talk(1)和write(1)等程序在该用户的终端上显示消息。
传统上,默认情况下允许写访问。然而,随着用户意识到各种安全风险,默认情况下,至少在主登录Shell中删除写入访问。为了确保tty为期望的设置,应该在登录脚本中执行mesg命令。所以你在一些Linux发行版的登录脚本中会看到mesg n这样一条命令。
命令参数
n:不接收消息。
y:允许接收消息。
如果没有给出参数,则命令mesg在标准错误上输出消息状态,即是否允许显示消息。
命令支持的选项及含义
-v, –verbose 显示将要执什么动作。
-V, –version 显示版本信息。
-h, –help 显示帮助信息。
退出状态
命令mesg会以如下状态值退出:
0 允许消息。
1 不允许消息。
>1 发生了错误。
相关文件
/dev/[pt]ty[pq]? 相关的终端文件。
相关手册
login(1), talk(1), write(1), wall(1), xterm(1)
参考文献

man 1 mesg, version util-linux

更新日志

09/01/2017 创建文章
07/10/2018 修改文件内容,准备mplinux发布。[……]

READ MORE

「mkfs(8)」-

构建一个Linux文件系统
命令语法格式
mkfs [options] [-t type] [fs-options] device [size]
命令描述
不推荐使用此mkfs前端程序,而使用文件系统特定的mkfs.<type>系列工具。
命令mkfs用于在设备上构建Linux文件系统,通常是硬盘分区。参数device是设备名称(例如/dev/hda1,/dev/sdb2)或包含文件系统的常规文件。参数size是要用于文件系统的块数。
实际上,mkfs只是Linux下可用的各种文件系统构建器(mkfs.fstype)的前端。 仅通过PATH环境设置搜索特定于文件系统的构建器。 有关更多详细信息,请参阅特定于文件系统的构建器手册页。
命令支持的选项及含义
-t, –type type 指定要构建的文件系统的类型。 如果未指定,则使用默认文件系统类型(当前为ext2)。
fs-options 特定于文件系统的选项,用于传递给真实文件系统构建器。
-V, –verbose 生成详细输出,包括执行的所有特定于文件系统的命令。 多次指定此选项会禁止执行任何特定于文件系统的命令。 这实际上只对测试有用。
-V, –version 显示版本信息并退出。 (选项-V仅在它是唯一参数时显示版本信息,否则它将作为–verbose。)
-h, –help 显示帮助信息并退出。
注意事项
所有通用选项必须在文件系统特定选项fs-options之前,而不是与其结合。 某些特定于文件系统的程序不会自动检测设备大小,并且需要指定size参数。
退出状态
0 成功;
1 失败;
相关手册
fs(5), badblocks(8), fsck(8), mkdosfs(8), mke2fs(8), mkfs.bfs(8), mkfs.ext2(8), mkfs.ext3(8), mkfs.ext4(8), mkfs.minix(8), mkfs.msdos(8), mkfs.vfat(8), mkfs.xfs(8)
参考文献

man 8 mkfs, Version mkfs from util-linux 2.32

更新日志

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

READ MORE

「mkfs.bfs(8)」-

制作一个SCO bfs文件系统
命令语法格式
mkfs.bfs [options] device [block-count]
命令描述
命令mkfs.bfs在块设备上创建SCO bfs文件系统(通常是磁盘分区,或通过循环设备访问的文件)。
参数block-count是文件系统的所需大小(以块为单位)。 如果未指定任何内容,则将使用整个分区。
命令支持的选项及含义
-N, –inodes number 指定所需的inode数量(最多512个)。 如果未指定任何内容,则会根据分区的大小选择48-512范围内的某个默认编号。
-v, –verbose 详细模式,显示执行的操作。
-V, –vname label 指定卷名。我不知道是否/在哪里使用它。
-F, –fname name 指定文件系统名称。我不知道是否/在哪里使用它。
其他选项
-c 该选项被静默的忽略。
-l 该选项被静默的忽略。
-h, –help 显示帮助信息并退出。
-V, –version 显示版本信息并退出。选项-V仅在作为唯一选项的–version时起作用。
退出状态
0 成功;
1 发生错误;
相关手册
mkfs(8)
参考文献

man 8 mkfs.bfs, Verison mkfs.bfs from util-linux 2.32

更新日志

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

READ MORE

「mkfs.cramfs(8)」-

创建压缩的ROM文件系统
命令语法格式
mkfs.cramfs [options] directory file
命令描述
在cramfs文件系统上的文件一次被zlib压缩一页,以允许随机读取访问。 元数据不是压缩的,而是以简洁的表示形式进行表示,比传统的文件系统更节省空间。
文件系统是有意为只读的,以简化其设计;压缩文件的随机写访问很难实现。 cramfs附带一个实用程序(mkcramfs)来将文件打包到新的cramfs映像中。
文件大小限制为小于16MB。
最大文件系统大小略低于272MB。 (文件系统上的最后一个文件必须在256MB块之前开始,但可以延伸到它之后。)
命令行选项
-b blocksize 使用定义的块大小,必须可以按页面大小整除。
-e edition 在超级块中,使用定义的文件系统版本号。
-N big, little, host 使用定义的字节顺序。默认值为“host”。
-i file 将file插入cramfs文件系统。
-n name 设置cramfs文件系统的名称。
-p 为启动代码填充512字节。
-z 创建明确洞。
-E 将所有警告视为错误,将其反映为命令返回值。
-v 启用详细模式,打印更多的信息。
其他选项
-s 该选项已被忽略。原始的-s选项用于打开目录条目排序。
-h, –help 显示帮助信息。
-V, –version 显示版本信息。
命令行参数
该directory只是我们想要生成压缩文件系统的目录树的根目录。
该file将包含cram文件系统,以后可以安装。
退出状态
0 成功;
8 操作错误,比如无法分配内存;
相关手册
fsck.cramfs(8), mount(8)
参考文献

man 8 mkfs.cramfs, Version mkfs.cramfs from util-linux 2.32.1

更新日志

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

READ MORE

「mkfs.minix(8)」-

制作一个Minix文件系统
命令语法格式
mkfs.minix [options] device [size-in-blocks]
命令描述
参数mkfs.minix在设备(通常是磁盘分区)上创建Linux MINIX文件系统。
该device通常具有以下形式:

/dev/hda[1–8] (IDE disk 1)
/dev/hdb[1–8] (IDE disk 2)
/dev/sda[1–8] (SCSI disk 1)
/dev/sdb[1–8] (SCSI disk 2)

该device可以是块设备或一个映像文件,但这不是强制执行的。期待在字符设备上没有多少乐趣:-)。
参数size-in-blocks是文件系统的所需大小(以块为单位)。 它仅用于向后兼容。 如果省略,将自动确定大小。 只允许块计数严格大于10且严格小于65536。
命令支持的选项及含义
-c, –check 在创建文件系统之前,请检查设备是否存在坏块。 如果找到,则打印计数。
-n, –namelength length 指定文件名的最大长度。 目前,文件系统版本1和2的唯一允许值为14和30。版本3仅允许值60。默认值为30。
-i, –inodes number 指定文件系统的inode数。
-l, –badblocks filename 从filename中读取坏块列表。该文件每行有一个坏块编号。打印读取坏块的计数。
-1 制作一个Minix 版本1的文件系统。这是默认的。
-2, -v 制作一个Minix 版本2的文件系统。
-3 制作一个Minix 版本3的文件系统。
-h, –help 显示帮助信息。
-V, –version 显示版本信息。
退出状态
0 无错误;
8 操作错误;
16 用法或语法错误;
相关手册
fsck(8), mkfs(8), reboot(8)
参考文献

man 8 mkfs.minix, Version mkfs.minix from util-linux 2.32.1

更新日志

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

READ MORE

「mkswap(8)」-

设置Linux交换区域
命令语法格式
mkswap [options] device [size]
命令描述
命令mkswap在设备或文件中设置Linux交换区域。
参数device通常是磁盘分区(类似于/dev/sdb7),但也可以是文件。Linux内核不会查看分区ID(分区类型),但许多安装脚本会假设十六进制类型“82”(LINUX_SWAP)的分区是交换分区。 (警告:Solaris也使用此类型。请注意不要杀掉Solaris分区。)
参数size是多余的,但保留了向后兼容性。(它指定1024字节块中所需的交换区大小。如果省略,mkswap将使用整个分区或文件。指定它是不明智的 – 错字可能会破坏你的磁盘。)
创建交换区域后,需要使用swapon(8)命令开始使用它。 交换区域通常列在/etc/fstab中,以便在引导时通过某些引导脚本中的swapon -a命令使用它们。
命令支持的选项及含义
-c, –check 在创建交换区域之前,检查设备(如果是块设备)是否存在坏块。 如果找到任何坏块,则打印计数。
-f, –force 即使命令是愚蠢的,也要继续。 这允许创建大于它所驻留的文件或分区的交换区域。
此外,如果没有此选项,mkswap将拒绝擦除使用分区表的设备上的第一个块。
-L, –label label 为设备指定标签(LABEL),以允许在执行swapon(8)时使用标签(LABEL)。
不必要使用的选项
-p, –pagesize size 指定要使用的页面大小(以字节为单位)。 这个选项通常是不必要的,因为mkswap从内核中读取大小。
-U, –uuid UUID 指定要使用的UUID。 默认UUID是自动生成的。
-v, –swapversion 1 指定交换空间版本。 (这个选项目前没有意义,因为旧的-v 0选项已经过时,现在只支持-v 1。内核自2.5.22(2002年6月)起不支持-v 0交换空间格式。新版本-v 1是自内核2.1.117(1998年8月)起支持。
其他选项
-h, –help 显示帮助信息并退出。
-V, –version 显示版本信息并退出。
注意事项
交换区域的最大有用大小取决于体系结构和内核版本。
交换区域标头可以寻址的最大页数为4294967295(UINT_MAX)。交换设备上的剩余空间将被忽略。
目前,Linux允许32个交换区域。可以在/proc/swaps文件中看到正在使用的交换区域。
命令mkswap拒绝小于10页的交换区域。
如果您不知道机器使用的页面大小,您可以使用“cat /proc/cpuinfo”[……]

READ MORE