多层次的帮助
whatis 使用数据库来显示命令的简短描述
刚安装后不可立即使用,需要制作数据库
#CentOS 7 版本以后
[root@centos8 ~]# mandb
Purging old database entries in /usr/share/man...
Processing manual pages under /usr/share/man...
Purging old database entries in /usr/share/man/hu...
Processing manual pages under /usr/share/man/hu...
Purging old database entries in /usr/share/man/ja...
Processing manual pages under /usr/share/man/ja...
Purging old database entries in /usr/share/man/fr...
Processing manual pages under /usr/share/man/fr...
.......
#CentOS 6 版本之前
makewhatis
范例
[root@centos8 ~]# whatis rm
rm (1) - remove files or directories
rm (1p) - remove directory entries
[root@centos8 ~]# whatis passwd
passwd (5) - password file
openssl-passwd (1ssl) - compute password hashes
passwd (1) - update user‘s authentication tokens
内部命令:
范例:
[root@centos8 ~]# help history
history: history [-c] [-d offset] [n] or history -anrw [filename] or history -ps arg [arg...]
Display or manipulate the history list.
Display the history list with line numbers, prefixing each modified
entry with a `*‘. An argument of N lists only the last N entries.
Options:
-c clear the history list by deleting all of the entries
-d offset delete the history entry at position OFFSET.
-a append history lines from this session to the history file
-n read all history lines not already read from the history file
and append them to the history list
-r read the history file and append the contents to the history
list
-w write the current history to the history file
-p perform history expansion on each ARG and display the result
without storing it in the history list
-s append the ARGs to the history list as a single entry
If FILENAME is given, it is used as the history file. Otherwise,
if HISTFILE has a value, that is used, else ~/.bash_history.
If the HISTTIMEFORMAT variable is set and not null, its value is used
as a format string for strftime(3) to print the time stamp associated
with each displayed history entry. No time stamps are printed otherwise.
Exit Status:
Returns success unless an invalid option is given or an error occurs.
[root@centos8 ~]# help echo
echo: echo [-neE] [arg ...]
Write arguments to the standard output.
Display the ARGs, separated by a single space character and followed by a
newline, on the standard output.
Options:
-n do not append a newline
-e enable interpretation of the following backslash escapes
-E explicitly suppress interpretation of backslash escapes
`echo‘ interprets the following backslash-escaped characters:
\a alert (bell)
\b backspace
\c suppress further output
\e escape character
\E escape character
\f form feed
\n new line
\r carriage return
\t horizontal tab
\v vertical tab
\\ backslash
\0nnn the character whose ASCII code is NNN (octal). NNN can be
0 to 3 octal digits
\xHH the eight-bit character whose value is HH (hexadecimal). HH
can be one or two hex digits
Exit Status:
Returns success unless a write error occurs.
[root@centos8 ~]# echo -e ‘\E[1;31mred]\E[0m‘
red]
[root@centos8 ~]# echo -e ‘\E[1;32mred\E[0m‘
red
[root@centos8 ~]# echo -e ‘\033[1;32mred\033[0m‘
red
BASH(1) General Commands Manual BASH(1)
NAME
bash - GNU Bourne-Again SHell
SYNOPSIS
bash [options] [command_string | file]
COPYRIGHT
Bash is Copyright (C) 1989-2016 by the Free Software Foundation, Inc.
DESCRIPTION
Bash is an sh-compatible command language interpreter that executes commands read from the standard input or from a
file. Bash also incorporates useful features from the Korn and C shells (ksh and csh).
Bash is intended to be a conformant implementation of the Shell and Utilities portion of the IEEE POSIX specifica‐
tion (IEEE Standard 1003.1). Bash can be configured to be POSIX-conformant by default.
OPTIONS
All of the single-character shell options documented in the description of the set builtin command can be used as
options when the shell is invoked. In addition, bash interprets the following options when it is invoked:
-c If the -c option is present, then commands are read from the first non-option argument command_string.
If there are arguments after the command_string, the first argument is assigned to $0 and any remaining
arguments are assigned to the positional parameters. The assignment to $0 sets the name of the shell,
which is used in warning and error messages.
-i If the -i option is present, the shell is interactive.
-l Make bash act as if it had been invoked as a login shell (see INVOCATION below).
-r If the -r option is present, the shell becomes restricted (see RESTRICTED SHELL below).
-s If the -s option is present, or if no arguments remain after option processing, then commands are read
Manual page bash(1) line 1 (press h for help or q to quit)
.......
外部命令和软件:
COMMAND --help 或 COMMAND -h
使用手册(manual)
man COMMAND
信息页
info COMMAND
程序自身的帮助文档
README
INSTALL
ChangeLog
程序官方文档
官方站点:Documentation
发行版的官方文档
显示用法总结和参数列表,使用的大多数,但并非所有的
范例:
[root@centos8 ~]# type date
date is /usr/bin/date
[root@centos8 ~]# date --help
Usage: date [OPTION]... [+FORMAT]
or: date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]]
Display the current time in the given FORMAT, or set the system date.
Mandatory arguments to long options are mandatory for short options too.
-d, --date=STRING display time described by STRING, not ‘now‘
--debug annotate the parsed date,
and warn about questionable usage to stderr
-f, --file=DATEFILE like --date; once for each line of DATEFILE
-I[FMT], --iso-8601[=FMT] output date/time in ISO 8601 format.
FMT=‘date‘ for date only (the default),
‘hours‘, ‘minutes‘, ‘seconds‘, or ‘ns‘
for date and time to the indicated precision.
Example: 2006-08-14T02:34:56-06:00
-R, --rfc-email output date and time in RFC 5322 format.
Example: Mon, 14 Aug 2006 02:34:56 -0600
--rfc-3339=FMT output date/time in RFC 3339 format.
FMT=‘date‘, ‘seconds‘, or ‘ns‘
for date and time to the indicated precision.
Example: 2006-08-14 02:34:56-06:00
-r, --reference=FILE display the last modification time of FILE
-s, --set=STRING set time described by STRING
-u, --utc, --universal print or set Coordinated Universal Time (UTC)
--help display this help and exit
--version output version information and exit
FORMAT controls the output. Interpreted sequences are:
%% a literal %
%a locale‘s abbreviated weekday name (e.g., Sun)
%A locale‘s full weekday name (e.g., Sunday)
%b locale‘s abbreviated month name (e.g., Jan)
%B locale‘s full month name (e.g., January)
%c locale‘s date and time (e.g., Thu Mar 3 23:05:25 2005)
%C century; like %Y, except omit last two digits (e.g., 20)
%d day of month (e.g., 01)
%D date; same as %m/%d/%y
%e day of month, space padded; same as %_d
%F full date; same as %Y-%m-%d
%g last two digits of year of ISO week number (see %G)
%G year of ISO week number (see %V); normally useful only with %V
%h same as %b
%H hour (00..23)
%I hour (01..12)
%j day of year (001..366)
%k hour, space padded ( 0..23); same as %_H
%l hour, space padded ( 1..12); same as %_I
%m month (01..12)
%M minute (00..59)
%n a newline
%N nanoseconds (000000000..999999999)
%p locale‘s equivalent of either AM or PM; blank if not known
%P like %p, but lower case
%q quarter of year (1..4)
%r locale‘s 12-hour clock time (e.g., 11:11:04 PM)
%R 24-hour hour and minute; same as %H:%M
%s seconds since 1970-01-01 00:00:00 UTC
%S second (00..60)
%t a tab
%T time; same as %H:%M:%S
%u day of week (1..7); 1 is Monday
%U week number of year, with Sunday as first day of week (00..53)
%V ISO week number, with Monday as first day of week (01..53)
%w day of week (0..6); 0 is Sunday
%W week number of year, with Monday as first day of week (00..53)
%x locale‘s date representation (e.g., 12/31/99)
%X locale‘s time representation (e.g., 23:13:48)
%y last two digits of year (00..99)
%Y year
%z +hhmm numeric time zone (e.g., -0400)
%:z +hh:mm numeric time zone (e.g., -04:00)
%::z +hh:mm:ss numeric time zone (e.g., -04:00:00)
%:::z numeric time zone with : to necessary precision (e.g., -04, +05:30)
%Z alphabetic time zone abbreviation (e.g., EDT)
By default, date pads numeric fields with zeroes.
The following optional flags may follow ‘%‘:
- (hyphen) do not pad the field
_ (underscore) pad with spaces
0 (zero) pad with zeros
^ use upper case if possible
# use opposite case if possible
After any flags comes an optional field width, as a decimal number;
then an optional modifier, which is either
E to use the locale‘s alternate representations if available, or
O to use the locale‘s alternate numeric symbols if available.
Examples:
Convert seconds since the epoch (1970-01-01 UTC) to a date
$ date --date=‘@2147483647‘
Show the time on the west coast of the US (use tzselect(1) to find TZ)
$ TZ=‘America/Los_Angeles‘ date
Show the local time for 9AM next Friday on the west coast of the US
$ date --date=‘TZ="America/Los_Angeles" 09:00 next Fri‘
GNU coreutils online help: <https://www.gnu.org/software/coreutils/>
Full documentation at: <https://www.gnu.org/software/coreutils/date>
or available locally via: info ‘(coreutils) date invocation‘
[root@centos8 ~]# date -d ‘-1 day‘ +%F
2020-05-31
[root@centos8 ~]# date -d ‘-1 day‘ +%F_%T
2020-05-31_17:05:57
[root@centos8 ~]# date -d ‘-1 day‘ +"%F %T"
2020-05-31 17:06:11
[root@centos8 ~]# cal -h
Usage:
cal [options] [[[day] month] year]
cal [options] <timestamp|monthname>
Display a calendar, or some part of it.
Without any arguments, display the current month.
Options:
-1, --one show only a single month (default)
-3, --three show three months spanning the date
-n, --months <num> show num months starting with date‘s month
-S, --span span the date when displaying multiple months
-s, --sunday Sunday as first day of week
-m, --monday Monday as first day of week
-j, --julian use day-of-year for all calendars
--reform <val> Gregorian reform date (1752|gregorian|iso|julian)
--iso alias for --reform=iso
-y, --year show the whole year
-Y, --twelve show the next twelve months
-w, --week[=<num>] show US or ISO-8601 week numbers
--color[=<when>] colorize messages (auto, always or never)
colors are enabled by default
-h, --help display this help
-V, --version display version
For more details see cal(1).
[root@centos8 ~]# openssl --help
Invalid command ‘--help‘; type "help" for a list
[root@centos8 ~]# shutdown -h
Shutdown scheduled for Mon 2020-06-01 17:16:05 CST, use ‘shutdown -c‘ to cancel.
man 提供命令帮助的文件,手册页存放在/usr/share/man
[root@centos8 ~]# ls /usr/share/man
ca de hu ja man1 man2 man3p man4x man6 man7x man9 nl pt_BR sv zh_CN
cs es id ko man1p man2x man3x man5 man6x man8 man9x pl ru tr zh_TW
da fr it man0p man1x man3 man4 man5x man7 man8x mann pt sk uk
几乎每个命令都有man的“页面”
中文man需安装包
man 章节
man页面分组为不同的“章节”,统称为Linux手册,man 1 man
man命令的配置文件:
#CentOS 6 之前版 man 的配置文件
/etc/man.config
#CentOS 7 之后版 man 的配置文件
/etc/man_db.conf
#ubuntu man 的配置文件
/etc/manpath.config
修改执行后要执行mandb才能生效
查看man需要whatis,whatis表示可以查看的章节
man 帮助段落说明
man命令的操作方法:使用less命令实现
列出所有帮助
man -a keyword
范例:
[root@centos8 ~]# man -a passwd
搜索man手册
#列出所有匹配的页面,使用 whatis 数据库
man -k keyword
[root@centos8 ~]# man -k password
chage (1) - change user password expiry information
chgpasswd (8) - update group passwords in batch mode
chpasswd (8) - update passwords in batch mode
cracklib-check (8) - Check passwords using libcrack2
create-cracklib-dict (8) - Check passwords using libcrack2
endpwent (3) - get password file entry
endspent (3) - get shadow password file entry
fgetpwent (3) - get password file entry
fgetspent (3) - get shadow password file entry
fgetspent_r (3) - get shadow password file entry
getpass (3) - get a password
getpw (3) - reconstruct password line entry
getpwent (3) - get password file entry
getpwnam (3) - get password file entry
getpwnam_r (3) - get password file entry
getpwuid (3) - get password file entry
getpwuid_r (3) - get password file entry
getspent (3) - get shadow password file entry
getspent_r (3) - get shadow password file entry
还可以再一次过滤
[root@centos8 ~]# man -k password |grep grub
grub2-setpassword (8) - Generate the user.cfg file containing the hashed grub bootloader password.
grub2-mkpasswd-pbkdf2 (1) - Generate a PBKDF2 password hash.
grub2-set-password (8) - Generate the user.cfg file containing the hashed grub bootloader password.
[root@centos8 ~]# man 8 grub2-setpassword
打印man帮助文件的路径
man -w [章节] keyword
范例:
[root@centos8 ~]# man -w ls
/usr/share/man/man1/ls.1.gz
[root@centos8 ~]# whatis ls
ls (1) - list directory contents
ls (1p) - list directory contents
[root@centos8 ~]# whatis -w 1p ls
ls (1) - list directory contents
ls (1p) - list directory contents
1p: nothing appropriate.
[root@centos8 ~]# man -w 1p ls
/usr/share/man/man1p/ls.1p.gz
注意:最小化安装需要安装man包
man常用于命令参考 ,GNU工具 info 适合通用文档参考
没有参数,列出所有的页面
info 页面的结构就像一个网站
每一页分为“节点”
链接节点之前 *
info 命令格式
info [ 命令 ]
导航info页
Applications -> documentation->help(centos7)
System->help(centos6)
/usr/share/doc 目录
root@centos8 ~]# ls /usr/share/doc
abattis-cantarell-fonts harfbuzz libunistring polkit
accountsservice hdparm libusal polkit-pkla-compat
adcli hicolor-icon-theme libusbmuxd poppler
adobe-mappings-cmap hostname libusbx popt
adobe-mappings-pdf HTML libuser postfix
alsa-lib hunspell libutempter prefixdevname
alsa-plugins-pulseaudio hunspell-en libv4l procps-ng
alsa-utils hunspell-en-GB libverto protobuf-c
aspell hunspell-en-US libvirt-daemon psacct
at hwdata libvirt-glib psmisc
........
[root@centos8 ~]# ls /usr/share/doc/less
INSTALL NEWS README
[root@centos8 ~]# cat /usr/share/doc/less/INSTALL
This file describes how to build and install less using
the "configure" script. This only works on Unix systems.
To install on other systems, read the README file.
Basic Installation
==================
These are generic installation instructions.
The `configure‘ shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile‘ in each directory of the package.
It may also create one or more `.h‘ files containing system-dependent
definitions. Finally, it creates a shell script `config.status‘ that
you can run in the future to recreate the current configuration, a file
`config.cache‘ that saves the results of its tests to speed up
.......
多数安装了的软件包的子目录,包括了这些软件的相关原理说明
常见文档:README INSTALL CHANGES
不适合其它地方的文档的位置
配置文件范例
HTML/PDF/PS 格式的文档
授权书详情
http://www.github.com
https://www.kernel.org/doc/html/latest/
http://httpd.apache.org
http://www.nginx.org
https://mariadb.com/kb/en
https://dev.mysql.com/doc/
http://tomcat.apache.org
https://jenkins.io/zh/doc/
https://kubernetes.io/docs/home/
https://docs.openstack.org/train/
http://www.python.org
http://php.net
通过发行版官方的文档光盘或网站可以获得安装指南、部署指南、虚拟化指南等
http://kbase.redhat.com
http://www.redhat.com/docs
http://access.redhat.com
https://help.ubuntu.com/lts/serverguide/index.html
rhn.redhat.com或者本地卫星服务器/代理服务器
RHN账户为及其注册和基于网络管理的RHN用户
sosreport 收集所有系统上的日志信息的工具,并自动打成压缩包,方便技术支持人员和红帽全球支持
提供分析问题依据
http://tldp.org
http://www.slideshare.net
http://www.google.com
Openstack filetype:pdf
rhca site:redhat.com/docs
原文:https://www.cnblogs.com/tfss/p/13029095.html