iis服务器助手广告广告
返回顶部
首页 > 资讯 > 操作系统 >Linux中的Manual手册分析
  • 281
分享到

Linux中的Manual手册分析

2023-06-15 17:06:04 281人浏览 八月长安
摘要

这篇文章主要讲解了“linux中的Manual手册分析”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“Linux中的Manual手册分析”吧!当今可能我们很多人已经不频繁使用man命令了,取而

这篇文章主要讲解了“linux中的Manual手册分析”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“Linux中的Manual手册分析”吧!

当今可能我们很多人已经不频繁使用man命令了,取而代之的是更加友好简单的tldr。

$ tldr du |head  du Disk usage: estimate and summarize file and directory space usage.   - List the sizes of a directory and any subdirectories, in the given unit (B/KB/MB):    du -{{b|k|m}} {{path/to/directory}}  - List the sizes of a directory and any subdirectories, in human-readable fORM (i.e. auto-selecting the appropriate unit for each size):    du -h {{path/to/directory}}r  - Show the size of a single directory, in human readable units:

然而,man命令始终是我个人的最爱。每当心情低落时候,我就会中用man命令信步由缰的做各种查询。从中慢慢获得秩序感,全局的掌控感,低落的心情也慢慢疗愈。

man命令让我们与计算机对话沟通,又仿佛促使我们与计算机融为一体,人机合一。

1.man的9个章节

man可能是唯一一个可以自我陈述的命令。我们先从最直觉的使用方法开始。

man man

 Linux中的Manual手册分析

从结果中,我们看到Manual手册共分为9个章节(sections)。似乎有点多,我们将归类为4个部分。

  • 前三项是commands(shell-commands, system-calls,libraries)

  • 接着是files(special-file,file-format)

  • 然后是Miscellaneous, Game也放在这里

  • 最后是System(Administation,Kernel)

2.存放地址

Linux系统中一切皆为文件,我们首先感兴趣的是,这些manual手册存放在哪里。根据前文 帮你精通Linux:透彻解析Linux的目录树结构  可以简单推测,

  • 配置文件在/etc/目录下,具体则为/etc/manpath.config;

  • 变量文件在/var/目录下,具体则为/var/cache/man/index.(bt|db|dir|pag)

/etc和/var是linux系统下的最重要的两个目录。

man文件本身存储在/usr/share目录下,/usr/share/man

如何查看特定命令的存储位置呢?需要 -w选项(对应长选项--where)

$ man -w time /usr/share/man/man1/time.1.gz

加上选-a(对应--all)则能查到time在所有章节中的位置。

$ man -aw time /usr/share/man/man1/time.1.gz /usr/share/man/man2/time.2.gz /usr/share/man/man7/time.7.gz

从结果中看到,在man1(shell commands), man2(system  calls)和man7(Miscellaneous)中都有time这个命令。

作为补充,我们也可以用-f选项查看命令所属的sections。

$ man -f man man (7)              - Macros to format man pages man (1)              - an interface to the on-line reference manuals  $ man -f time time (7)             - overview of time and timers time (1)             - run programs and summarize system resource usage time (2)             - get time in seconds

此处的 -f 等价于--whatis

whatis (1) - display one-line manual page descriptions

3.指定查询章节

从 -w 选项中看到了命令的地址,便可以指定章节查询。

whatis (1)           - display one-line manual page descriptions

Linux中的Manual手册分析

man  7 time

Linux中的Manual手册分析

4.正则查询

man命令最有意思的就是正则查询,心情不好的时候,可以玩上一整天。

从正则查询中,能够获得对全局的掌控感,比如查询systemd有多少个命令:

$ man -k ^systemd |nl |tail     158  systemd.service (5)  - Service unit configuration    159  systemd.slice (5)    - Slice unit configuration    160  systemd.Socket (5)   - Socket unit configuration    161  systemd.special (7)  - Special systemd units    162  systemd.swap (5)     - Swap unit configuration    163  systemd.syntax (7)   - General syntax of systemd configuration files    164  systemd.target (5)   - Target unit configuration    165  systemd.time (7)     - Time and date specifications    166  systemd.timer (5)    - Timer unit configuration    167  systemd.unit (5)     - Unit configuration

从结果中国马上获知167这个结果。

或者查询有多少与calendar相关的命令:

$ man -k calendar |nl      1  cal (1)              - displays a calendar and the date of Easter      2  calendar (1)         - reminder service      3  ncal (1)             - displays a calendar and the date of Easter

又或者查询全部的ls命令:

$ man -k ^ls |nl      1  ls (1)               - list directory contents      2  lsar (1)             - list arcHive file contents      3  lsattr (1)           - list file attributes on a Linux second extended file system      4  lsb_release (1)      - print distribution-specific information      5  lsblk (8)            - list block devices      6  lscpu (1)            - display information about the CPU architecture      7  lsearch (3)          - linear search of an array      8  lseek (2)            - reposition read/write file offset      9  lseek64 (3)          - reposition 64-bit read/write file offset     10  lsetxattr (2)        - set an extended attribute value     11  lshw (1)             - list hardware     12  lsinitramfs (8)      - list content of an initramfs image     13  lsipc (1)            - show information on IPC facilities currently employed in ...     14  lslocks (8)          - list local system locks     15  lslogins (1)         - display information about known users in the system     16  lsmem (1)            - list the ranges of available memory with their online status     17  lsmod (8)            - Show the status of modules in the Linux Kernel     18  lsns (8)             - list namespaces     19  lsof (8)             - list open files     20  lspci (8)            - list all PCI devices     21  lspcmcia (8)         - display extended PCMCIA debugging information     22  lspgpot (1)          - extracts the ownertrust values from PGP keyrings and list...     23  lstat (2)            - get file status     24  lstat64 (2)          - get file status     25  lsusb (8)            - list USB devices

5.全局掌控

文章开头就介绍过section 2 中是system-calls命令。我们不免心生好奇,哪些是system-calls呢?

$ man -s 2 -k . |nl |tail    484  vm86old (2)          - enter virtual 8086 mode    485  vmsplice (2)         - splice user pages to/from a pipe    486  vserver (2)          - unimplemented system calls    487  wait (2)             - wait for process to change state    488  wait3 (2)            - wait for process to change state, BSD style    489  wait4 (2)            - wait for process to change state, BSD style    490  waitid (2)           - wait for process to change state    491  waitpid (2)          - wait for process to change state    492  write (2)            - write to a file descriptor    493  writev (2)           - read or write data into multiple buffers

由上可知,系统中共有493个system-calls。我们分析下这一行命令:

man -s 2 -k .

短选代表的是长选项--section,-k 是 keyWord,等价于 apropos命令,最后的 dot 点  乃是正则表达式里的任意字符的表达方式。

于是,仅仅通过上面的简单命令获得对整个文档乃至整台计算机,整个计算机科学的全局掌控感。我们迅速掠览一遍这9个sections。

Section 1 Shell Commands系统命令:

$ man -s 1 -k . |nl| tail -n 5   2451  zless (1)            - file perusal filter for crt viewing of compressed text   2452  zlib_decompress (1)  - decompress mysqlpump ZLIB-compressed output   2453  zmore (1)            - file perusal filter for crt viewing of compressed text   2454  znew (1)             - recompress .Z files to .gz files   2455  zsoelim (1)          - satisfy .so requests in roff input

Section 2 Syetem Calls系统调用

$ man -s 2 -k . |nl| tail -n 5    489  wait4 (2)            - wait for process to change state, BSD style    490  waitid (2)           - wait for process to change state    491  waitpid (2)          - wait for process to change state    492  write (2)            - write to a file descriptor    493  writev (2)           - read or write data into multiple buffers

Section 3 C LIbraries C语库

$ man -s 3 -k . |nl| tail -n 5   1899  y1l (3)              - Bessel functions of the second kind   1900  yn (3)               - Bessel functions of the second kind   1901  ynf (3)              - Bessel functions of the second kind   1902  ynl (3)              - Bessel functions of the second kind   1903  zlib (3)             - compression/decompression library

Section 4 Special Files 特殊文件

$ man -s 4 -k . |nl| tail -n 5     48  veth (4)             - Virtual Ethernet Device     49  vmware (4)           - VMware SVGA video driver     50  wacom (4)            - Wacom input driver     51  wavelan (4)          - AT&T GIS WaveLAN ISA device driver     52  zero (4)             - data sink

Secion 5 File Format and conventions 文件格式及惯例

$ man -s 5 -k . |nl| tail -n 5    424  xorg.conf (5)        - configuration files for Xorg X server    425  xorg.conf.d (5)      - configuration files for Xorg X server    426  Xsession (5)         - initialize X session    427  Xsession.options (5) - configuration options for Xsession (5)    428  Xwrapper.config (5)  - Xorg X server binary wrapper

Secion 6 Games 游戏

$ man -s 6 -k . |nl| tail -n 5      1  intro (6)            - introduction to games      2  kmahjongg (6)        - Mahjongg game for KDE      3  kmines (6)           - KDE mine sweeper game      4  kpat (6)             - A highly addictive card game.      5  ksudoku (6)          - KDE Sudoku games

Section 7 Miscellaneous (including macro packages and conventions)杂项

$ man -s 7 -k . |nl| tail -n 5    470  XConsortium (7)      - X Consortium information    471  xkeyboard-config (7) - XKB data description files    472  XOrgFoundation (7)   - X.Org Foundation information    473  Xsecurity (7)        - X display access control    474  XStandards (7)       - X Window System Standards and Specifications

Section 8 System administration commands (usually only for root)系统管理命令

$ man -s 8 -k . |nl| tail -n 5    890  xtables-nft-multi (8) - iptables using nftables kernel api    891  xtables-translate (8) - translation tool to migrate from iptables to nftables    892  zdump (8)            - timezone dumper    893  zic (8)              - timezone compiler    894  zramctl (8)          - set up and control zram devices

Section 9 Kernel routines [Non standard] 内核函数

➜  ~ man -s 9 -k . vmxnet (9)           - vmware kernel module

掌控全局还有另外一种方法,就是intro命令:

$ man -f intro intro (8)            - introduction to administration and privileged commands intro (7)            - introduction to overview and miscellany section intro (3)            - introduction to library functions intro (4)            - introduction to special files intro (1)            - introduction to user commands intro (5)            - introduction to file formats and filesystems intro (6)            - introduction to games intro (2)            - introduction to system calls

我们看到每个section都有一个intro。

比如我们查看section 2的intro:

Linux中的Manual手册分析

6.游戏

man命令有良好的疗愈功效,不妨来看看Kubuntu自带的四个游戏。

$ man -s 6 -k . |nl      1  intro (6)            - introduction to games      2  kmahjongg (6)        - Mahjongg game for KDE      3   (6)           - KDE mine sweeper game      4  kpat (6)             - A highly addictive card game.      5  ksudoku (6)          - KDE Sudoku games

感谢各位的阅读,以上就是“Linux中的Manual手册分析”的内容了,经过本文的学习后,相信大家对Linux中的Manual手册分析这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是编程网,小编将为大家推送更多相关知识点的文章,欢迎关注!

--结束END--

本文标题: Linux中的Manual手册分析

本文链接: https://www.lsjlt.com/news/281079.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

本篇文章演示代码以及资料文档资料下载

下载Word文档到电脑,方便收藏和打印~

下载Word文档
猜你喜欢
  • Linux中的Manual手册分析
    这篇文章主要讲解了“Linux中的Manual手册分析”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“Linux中的Manual手册分析”吧!当今可能我们很多人已经不频繁使用man命令了,取而...
    99+
    2023-06-15
  • Apache教程Hudi与Hive集成手册的示例分析
    小编给大家分享一下Apache教程Hudi与Hive集成手册的示例分析,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!1. Hudi表对应的Hive外部表介绍Hud...
    99+
    2023-06-29
  • vue中登录注册的示例分析
    这篇文章主要介绍了vue中登录注册的示例分析,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。步骤一1.安装脚手架:npm install vu...
    99+
    2024-04-02
  • 如何进行springcloud中的注册中心Eureka分析
    如何进行springcloud中的注册中心Eureka分析,相信很多没有经验的人对此束手无策,为此本文总结了问题出现的原因和解决方法,通过这篇文章希望你能解决这个问题。Eureka是Netflix开源的一款提供服务注册和发现的产品,它提供了...
    99+
    2023-06-05
  • linux中make的示例分析
    小编给大家分享一下linux中make的示例分析,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!规则规则rule是指示 make 应该如何并且何时构建一个被称作为目...
    99+
    2023-06-16
  • linux中iostat的示例分析
    这篇文章主要介绍linux中iostat的示例分析,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!iostat主要用于报告中央处理器(CPU)统计信息和整个系统、适配器、tty 设备、磁盘和 CD-ROM 的输入/输出...
    99+
    2023-06-12
  • Linux中Base64的示例分析
    这篇文章主要为大家展示了“Linux中Base64的示例分析”,内容简而易懂,条理清晰,希望能够帮助大家解决疑惑,下面让小编带领大家一起研究并学习一下“Linux中Base64的示例分析”这篇文章吧。Base64编码在电子邮件中很常见,Fo...
    99+
    2023-06-27
  • 手动注册binlog文件造成主从异常的示例分析
    这篇文章给大家分享的是有关手动注册binlog文件造成主从异常的示例分析的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。一、问题来源有一个朋友@水米田 问我,基于POSITION的...
    99+
    2024-04-02
  • Linux中堆栈的示例分析
    这篇文章给大家分享的是有关Linux中堆栈的示例分析的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。用下面的程序作为例子:void a() {    &n...
    99+
    2023-06-16
  • Linux中日志的示例分析
    这篇文章主要介绍Linux中日志的示例分析,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!日志的三种类型#内核及系统日志:这种日志数据由系统服务rsyslog统一管理,根据其主配置文件/etc/rsyslog.conf...
    99+
    2023-06-27
  • Linux中信号量的示例分析
    这篇文章给大家分享的是有关Linux中信号量的示例分析的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。Linux系统提出了信号量的概念。这是一种相对比较折中的处理方式,它既能保证线程间同步,数据不混乱,又能提高线程...
    99+
    2023-06-15
  • jQuery中正则验证注册页面的示例分析
    这篇文章给大家分享的是有关jQuery中正则验证注册页面的示例分析的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。具体如下:<!DOCTYPE html> &...
    99+
    2024-04-02
  • linux中page buffer cache的示例分析
    小编给大家分享一下linux中page buffer cache的示例分析,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!Page cache和buffer cac...
    99+
    2023-06-13
  • Linux中重定向的示例分析
    这篇文章给大家分享的是有关Linux中重定向的示例分析的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。简介      在计算领域,重定向是大多数命令行解释器所具有的...
    99+
    2023-06-09
  • linux中ELF文件的示例分析
    这篇文章给大家分享的是有关linux中ELF文件的示例分析的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。示例程序我们的示例程序如下:#include<stdio.h> int ma...
    99+
    2023-06-16
  • Linux中cpufreq机制的示例分析
    小编给大家分享一下Linux中cpufreq机制的示例分析,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!从 2.6.0 Linux 内核开始,您可以通过 CPUf...
    99+
    2023-06-27
  • Linux中GPG加密的示例分析
    这篇文章主要介绍了Linux中GPG加密的示例分析,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。GPG 可以用来签署和加密数据。方便发送和接收方进行数据加密和对方身份的确认。...
    99+
    2023-06-27
  • 如何分析Linux系统中的pam
    这篇文章主要为大家分析了如何分析Linux系统中的pam的相关知识点,内容详细易懂,操作细节合理,具有一定参考价值。如果感兴趣的话,不妨跟着跟随小编一起来看看,下面跟着小编一起深入学习“如何分析Linux系统中的pam”的知识吧。一、pam...
    99+
    2023-06-28
  • Linux中who命令的使用分析
    这篇文章给大家介绍Linux中who命令的使用分析,内容非常详细,感兴趣的小伙伴们可以参考借鉴,希望对大家能有所帮助。关于who  显示登录系统的用户。执行who命令可得知目前有那些用户登入系统,单独执行who命令会列出登入帐号,使用的终端...
    99+
    2023-06-05
  • Linux中Rsync服务的示例分析
    小编给大家分享一下Linux中Rsync服务的示例分析,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!Rsync是Linux系统中的数据镜像备份工具,通过rsync...
    99+
    2023-06-27
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作