linux命令——man

Shell(也称为终端或壳) 用户与 Linux 系统的交互

常见执行Linux命令的格式是这样的: 命令名称 [命令参数] [命令对象]linux

注意,命令名称、命令参数、命令对象之间请用空格键分隔。app

命令对象通常是指要处理的文件、目录、用户等资源,而命令参数能够用长格式(完整的选项名称),ide

也能够用短格式(单个字母的缩写),二者分别用--与-做为前缀函数

令参数的长格式与短格式示例ui

长格式spa

man --help命令行

短格式regexp

man -horm

查看帮助命令

在命令行终端中输入man man命令来查看man命令自身的帮助信息对象

man命令中经常使用按键以及用途

按键

用途

空格键

向下翻一页

PaGe down

向下翻一页

PaGe up

向上翻一页

home

直接前往首页

end

直接前往尾页

/

从上至下搜索某个关键词,如“/linux”

?

从下至上搜索某个关键词,如“?linux”

n

定位到下一个搜索到的关键词

N

定位到上一个搜索到的关键词

q

退出帮助文档

man命令帮助信息的结构以及意义

结构名称

表明意义

NAME

命令的名称

SYNOPSIS

参数的大体使用方法

DESCRIPTION

介绍说明

EXAMPLES

演示(附带简单说明)

OVERVIEW

概述

DEFAULTS

默认的功能

OPTIONS

具体的可用选项(带介绍)

ENVIRONMENT

环境变量

FILES

用到的文件

SEE ALSO

相关的资料

HISTORY

维护历史与联系方式

帮助命令man  (manual)

 

好比咱们能够看下man命令的解释

[root@localhost ~]# man man

 

MAN(1)                                                  Manual pager utils                                                 MAN(1)

 

NAME

       man - an interface to the on-line reference manuals

 

SYNOPSIS

       man [-C file] [-d] [-D] [--warnings[=warnings]] [-R encoding] [-L locale] [-m system[,...]] [-M path] [-S list] [-e exten‐

       sion] [-i|-I] [--regex|--wildcard] [--names-only] [-a] [-u] [--no-subpages] [-P pager]  [-r  prompt]  [-7]  [-E  encoding]

       [--no-hyphenation]   [--no-justification]   [-p   string]   [-t]  [-T[device]]  [-H[browser]]  [-X[dpi]]  [-Z]  [[section]

       page ...] ...

       man -k [apropos options] regexp ...

       man -K [-w|-W] [-S list] [-i|-I] [--regex] [section] term ...

       man -f [whatis options] page ...

       man -l [-C file] [-d] [-D] [--warnings[=warnings]] [-R encoding] [-L locale] [-P pager] [-r prompt] [-7] [-E encoding] [-p

       string] [-t] [-T[device]] [-H[browser]] [-X[dpi]] [-Z] file ...

       man -w|-W [-C file] [-d] [-D] page ...

       man -c [-C file] [-d] [-D] page ...

       man [-?V]

 

DESCRIPTION

       man  is the system's manual pager. Each page argument given to man is normally the name of a program, utility or function.

       The manual page associated with each of these arguments is then found and displayed. A section, if provided,  will  direct

       man to look only in that section of the manual.  The default action is to search in all of the available sections, follow‐

 Manual page man(1) line 1 (press h for help or q to quit)

 

查看完 按 "q"键,离开

 

咱们看下ls

man ls

 

 

这里其实有不少行 咱们能够按键盘的向下键盘,来显示下方隐藏的内容;

 

固然也能够搜索 

/  加搜索内容

好比搜索 -d

/-d

 

 

这里的1是man的级别; 这里的1是查看命令的帮助

 

1:查看命令的帮助

2:查看可被内核调用的函数的函数的版主

3:查看函数和函数库的帮助

4:查看特殊文件的帮助(主要是/dev目录下的文件)

5:查看配置文件的帮助

6:查看游戏的帮助

7:查看其余杂项的帮助

8:查看系统管理员可用命令的帮助

9:查看和内核相关文件的帮助

 

查看命令拥有哪一个级别的帮助

man -f 命令

至关于

whatis 命令

举例

man -5 passwd

man -4 null

man -8 ip

 

好比查看ls的命令级别

[root@localhost ~]# man -f ls

ls (1)               - list directory contents

[root@localhost ~]# 

 

只有1个

 

[root@localhost ~]# man -f ip

ip (8)               - show / manipulate routing, devices, policy routing...

[root@localhost ~]# 

 

 

查看和命令相关的全部帮助

man -k 命令

至关于

appropos 命令

例如

apropos passwd

 

[root@localhost ~]# man -k passwd

chpasswd (8)         - 批量更新密码

gpasswd (1)          - 管理员 /etc/group 和 /etc/gshadow

grub2-mkpasswd-pbkdf2 (1) - Generate a PBKDF2 password hash.

lpasswd (1)          - Change group or user password

pam_localuser (8)    - require users to be listed in /etc/passwd

passwd (1)           - update user's authentication tokens

sslpasswd (1ssl)     - compute password hashes

pwhistory_helper (8) - Helper binary that transfers password hashes from ...

[root@localhost ~]# 

 

能把相关的命令都查询出来;