《小菜狗 Linux 操作系统快速入门笔记》目录:
《小菜狗 Linux 操作系统快速入门笔记》(01.0)文章导航目录【实时更新】
1、帮助手册命令【man】
man 是 Linux 提供的一个手册,包含了绝大部分的命令、函数使用说明。
- 该手册分成很多章节(section),使用 man 时可以指定不同的章节来浏览。
- man 是按照手册的章节号的顺序进行搜索的。
遇到一些函数和命令,不知道含义时,可以使用命令 man 来查看帮助信息。
例如查看 ls 命令的第一章节的帮助:
man 1 ls

1.1、man 手册章节
man 手册根据内容分为 9 个章节(section),可以使用下面命令查看:
man man

man 文档的各个章节(section)意义如下:
1 - commands(普通的命令)
2 - system calls(系统调用,如 open, write)
3 - library calls(库函数,如 printf, fopen)
4 - special files(特殊文件:/dev下设备文件)
5 - file formats and convertions(文件格式,如 passwd)
6 - games for linux(游戏和娱乐)
7 - macro packages and conventions(杂项、惯例与协定等,例如 Linux 档案系统、网络协定、ASCII 码;environ 全局变量)
8 - system management commands(管理员命令,如 ifconfig)
9 - 其他(Linux特定, 用来存放内核例行程序的文档)
1.2、功能快捷键
man 设置了如下的功能键:

1.3、-k 参数
使用 -k 参数,man 可以在所有的 man 文档和简介中查找符合条件的命令。
peng@ubuntu:~/test$ man -k bash
bash (1) - GNU Bourne-Again SHell
bash-builtins (7) - bash built-in commands, see bash(1)
bashbug (1) - report a bug in bash
builtins (7) - bash built-in commands, see bash(1)
dh_bash-completion (1) - install bash completions for package
rbash (1) - restricted bash, see bash(1)
1.4、-f 参数
有的关键词在系统中对应多个手册, 使用 -f 参数,用于查找同名的手册:
peng@ubuntu:~/test$ 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
1.5、查询 Linux 内置的帮助文件
例如:输入“man date”回车,就可显示命令 date 的帮助文档,如下所示:


2、命令帮助长参数【–help】
man 命令像新华词典一样可以查询到命令或函数的详细信息,但其实我们还有更加快捷的方式去查询,
command --help或command -h,它没有 man 命令显示的那么详细,但是它更加易于阅读。
一般 Linux 基本每个命令都自带有 --help 这个参数的帮助信息!
格式:
command --help
如:
ls --help
$ ls --help
Usage: ls [OPTION]... [FILE]...
List information about the FILEs (the current directory by default).
Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.
Mandatory arguments to long options are mandatory for short options too.
-a, --all do not ignore entries starting with .
-A, --almost-all do not list implied . and ..
--author with -l, print the author of each file
-b, --escape print C-style escapes for nongraphic characters
等等省略...
《小菜狗 Linux 操作系统快速入门笔记》目录:
《小菜狗 Linux 操作系统快速入门笔记》(01.0)文章导航目录【实时更新】
每日一更!
公众号、CSDN等博客:小菜狗编程笔记
谢谢点赞关注哈!目前在飞书持续优化更新~
日更较慢有需要完整笔记请私我,C/C++/数据结构-算法/单片机51-STM32-GD32-ESP32/嵌入式/Linux操作系统/uboot/Linux内核-驱动-应用/硬件入门-PCB-layout/Python/后期小程序和机器学习!
所有命令的帮助命令&spm=1001.2101.3001.5002&articleId=148386200&d=1&t=3&u=670abcdabf484d458a87c17785179c5c)
571

被折叠的 条评论
为什么被折叠?



