玩转Redhat Linux 8.0系列 | 阅读MAN PAGE

素材来源:Redhat Linux 8.0培训教材《RH124》、《RH134》和《RH294》

玩了5-6年的Linux,现在再来温习一遍RHCE培训教材,按照指导完成实验并与大家分享。

附上汇总贴:玩转Redhat Linux 8.0系列 | 合集_热爱编程的通信人的博客-CSDN博客


1 在workstation上查看gedit man page。从命令行使用gedit查看用于编辑特定文件的选项。

使用gedit man page中的一个选项, 通过gedit打开/home/student/manual文件,光标位于文件的末尾。

1.1 查看gedit man page。

[student@workstation ~]$ man gedit
GEDIT(1)                                                    General Commands Manual                                                    GEDIT(1)

NAME
       gedit - text editor for the GNOME Desktop

SYNOPSIS
       gedit [OPTION...] [FILE...] [+LINE[:COLUMN]]
       gedit [OPTION...] -

DESCRIPTION
       gedit is the official text editor of the GNOME desktop environment.

       While  aiming  at  simplicity  and  ease of use, gedit is a powerful general purpose text editor.  It can be used to create and edit all
       kinds of text files.

       gedit features a flexible plugin system which can be used to dynamically add new advanced features to gedit itself.

OPTIONS
       --encoding
              Set the character encoding to be used for opening the files listed on the command line.

       --list-encodings
              Display list of possible values for the encoding option and exit.

       --new-window
              Create a new toplevel window in an existing instance of gedit.

       --new-document
              Create a new document in an existing instance of gedit.

       -s, --standalone
              Run gedit in standalone mode.

       -w, --wait
              Open files and block the gedit process.

       --help Prints the command line options.

       --version
              Output version information and exit.

       FILE   Specifies the file to open when gedit starts. If this is not specified, gedit will load a blank file with an  "Unsaved  Document"
[student@workstation ~]$

1.2 在gedit man page中, 了解用于从命令行编辑特定文件的选项。

--version
              Output version information and exit.

       FILE   Specifies the file to open when gedit starts. If this is not specified, gedit will load a blank file with an  "Unsaved  Document"
              label.  Multiple files can be loaded if they are separated by spaces.  gedit also supports handling of remote files. For example,
              you can pass the location of a webpage to gedit  ,  like  "http://www.gnome.org",  or  load  a  file  from  a  FTP  server,  like
              "ftp://ftp.gnome.org/robots.txt".

       -      gedit will read from stdin

       +LINE  For  the  first  file,  go to the line specified by LINE (do not insert a space between the "+" sign and the number).  If LINE is
              missing, go to the last line.

按q键退出man page。

1.3 使用gedit +命令打开manual文件。+选项旁边缺少行号会打开一个作为参数传递的文件,而光标位于最后一行的末尾。

[student@workstation ~]$ gedit + manual

确认文件已打开, 且光标位于文件最后一行的末尾。按Ctrl+q关闭应用程序。

2 阅读su(1) man page。

请注意,如果省略了用户,su命令会假定用户是root。如果su命令后跟一个短划线(-),它将启动一个子登录shell。如果不使用单短划线, 则会创建与用户当前环境匹配的非登录子shell。

[student@workstation ~]$ man 1 su
SU(1)                                                            User Commands                                                            SU(1)

NAME
       su - run a command with substitute user and group ID

SYNOPSIS
       su [options] [-] [user [argument...]]

DESCRIPTION
       su allows to run commands with a substitute user and group ID.

       When called without arguments, su defaults to running an interactive shell as root.

       For  backward  compatibility,  su  defaults to not change the current directory and to only set the environment variables HOME and SHELL
       (plus USER and LOGNAME if the target user is not root).  It is recommended to always use the --login option (instead of its shortcut  -)
       to avoid side effects caused by mixing environments.

       This  version of su uses PAM for authentication, account and session management.  Some configuration options found in other su implemen‐
       tations, such as support for a wheel group, have to be configured via PAM.

       su is mostly designed for unprivileged users, the recommended solution for privileged users (e.g. scripts executed by root)  is  to  use
       non-set-user-ID  command  runuser(1)  that does not require authentication and provide separate PAM configuration. If the PAM session is
       not required at all then the recommend solution is to use command setpriv(1).

OPTIONS
       -c, --command=command
              Pass command to the shell with the -c option.

       -f, --fast
              Pass -f to the shell, which may or may not be useful, depending on the shell.

       -g, --group=group
              Specify the primary group.  This option is available to the root user only.

       -G, --supp-group=group
              Specify a supplemental group.  This option is available to the root user only.  The first specified supplementary group  is  also
              used as a primary group if the option --group is unspecified.

       -, -l, --login
              Start the shell as a login shell with an environment similar to a real login:

                 o      clears all the environment variables except TERM
[student@workstation ~]$

按q键退出man page。

3 man命令也有自己的man page。

[student@workstation ~]$ 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 extension] [-i|-I]
       [--regex|--wildcard] [--names-only] [-a] [-u] [--no-subpages] [-P pager] [-r prompt] [-7] [-E encoding] [--no-hyphenation]  [--no-justi‐
       fication] [-p string] [-t] [-T[device]] [-H[browser]] [-X[dpi]] [-Z] [[section] page[.section] ...] ...
       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 following a pre-defined order ("1 1p 8 2 3 3p 4
       5  6  7  9  0p n l p o 1x 2x 3x 4x 5x 6x 7x 8x" by default, unless overridden by the SECTION directive in /etc/man_db.conf), and to show
       only the first page found, even if page exists in several sections.

       The table below shows the section numbers of the manual followed by the types of pages they contain.

       1   Executable programs or shell commands
       2   System calls (functions provided by the kernel)
       3   Library calls (functions within program libraries)
       4   Special files (usually found in /dev)
       5   File formats and conventions eg /etc/passwd
       6   Games
       7   Miscellaneous (including macro packages and conventions), e.g. man(7), groff(7)
       8   System administration commands (usually only for root)
       9   Kernel routines [Non standard]

       A manual page consists of several sections.

       Conventional section names include NAME, SYNOPSIS, CONFIGURATION, DESCRIPTION, OPTIONS, EXIT STATUS, RETURN VALUE, ERRORS,  ENVIRONMENT,
       FILES, VERSIONS, CONFORMING TO, NOTES, BUGS, EXAMPLE, AUTHORS, and SEE ALSO.

[student@workstation ~]$

按q键退出man page。

4 所有man page都位于/usr/share/man。使用whereis命令, 查找位于/usr/share/man目录中的二进制文件、源代码和man page。

[student@workstation ~]$ whereis passwd
passwd: /usr/bin/passwd /etc/passwd /usr/share/man/man1/passwd.1.gz /usr/share/man/man5/passwd.5.gz
[student@workstation ~]$

5 使用man -k zip命令来列出关于ZIP存档的详细信息。

[student@workstation ~]$ man -k zip
bunzip2 (1)          - a block-sorting file compressor, v1.0.6
bzcmp (1)            - compare bzip2 compressed files
bzdiff (1)           - compare bzip2 compressed files
bzegrep (1)          - search possibly bzip2 compressed files for a regular expression
bzfgrep (1)          - search possibly bzip2 compressed files for a regular expression
bzgrep (1)           - search possibly bzip2 compressed files for a regular expression
bzip2 (1)            - a block-sorting file compressor, v1.0.6
bzip2recover (1)     - recovers data from damaged bzip2 files
bzless (1)           - file perusal filter for crt viewing of bzip2 compressed text
bzmore (1)           - file perusal filter for crt viewing of bzip2 compressed text
funzip (1)           - filter for extracting from a ZIP archive in a pipe
grubby (8)           - command line tool for configuring grub and zipl
gunzip (1)           - compress or expand files
gzip (1)             - compress or expand files
mzip (1)             - change protection mode and eject disk on Zip/Jaz drive
prezip-bin (1)       - prefix zip delta word list compressor/decompressor
unzip (1)            - list, test and extract compressed files in a ZIP archive
unzipsfx (1)         - self-extracting stub for prepending to ZIP archives
zforce (1)           - force a '.gz' extension on all gzip files
zip (1)              - package and compress (archive) files
zipcloak (1)         - encrypt entries in a zipfile
zipgrep (1)          - search files in a ZIP archive for lines matching a pattern
zipinfo (1)          - list detailed information about a ZIP archive
zipnote (1)          - write the comments in zipfile to stdout, edit comments and rename files in zipfile
zipsplit (1)         - split a zipfile into smaller zipfiles
[student@workstation ~]$

6 使用man -k boot来列出包含可在启动时传输到内核的参数列表的man page。

[student@workstation ~]$ man -k boot
binfmt.d (5)         - Configure additional binary formats for executables at boot
bootctl (1)          - Control the firmware and boot manager settings
bootparam (7)        - introduction to boot time parameters of the Linux kernel
bootup (7)           - System bootup process
dracut.bootup (7)    - boot ordering in the initramfs
grub2-reboot (8)     - Set the default boot menu entry for the next boot only.
grub2-set-bootflag (1) - Set a bootflag in the GRUB environment block.
grub2-bios-setup (8) - Set up images to boot from a device.
grub2-mkimage (1)    - Make a bootable GRUB image.
grub2-mknetdir (1)   - Prepare a GRUB netboot directory.
grub2-set-default (8) - Set the default boot menu entry for GRUB.
grub2-set-password (8) - Generate the user.cfg file containing the hashed grub bootloader password.
grub2-setpassword (8) - Generate the user.cfg file containing the hashed grub bootloader password.
grub2-sparc64-setup (8) - Set up a device to boot a sparc64 GRUB image.
halt (8)             - Halt, power-off or reboot the machine
initrd (4)           - boot loader initialized RAM disk
iscsistart (8)       - iSCSI boot tool
kernel-install (8)   - Add and remove kernel and initramfs images to and from /boot
kexec (8)            - directly boot into a new kernel
loader.conf (5)      - Configuration file for systemd-boot
lvm2-activation-generator (8) - generator for systemd units to activate LVM volumes on boot
modules-load.d (5)   - Configure kernel modules to load at boot
nm-initrd-generator (8) - early boot NetworkManager configuration generator
ostree (1)           - Manage multiple bootable versioned filesystem trees
perlboot (1)         - Links to information on object-oriented programming in Perl
plymouth (8)         - A graphical boot system and logger
poweroff (8)         - Halt, power-off or reboot the machine
reboot (2)           - reboot or enable/disable Ctrl-Alt-Del
reboot (8)           - Halt, power-off or reboot the machine
rescan-scsi-bus.sh (8) - script to add and remove SCSI devices without rebooting
rpc.sm-notify (8)    - send reboot notifications to NFS peers
scsi-rescan (8)      - script to add and remove SCSI devices without rebooting
sd-boot (7)          - A simple UEFI boot manager
shutdown (8)         - Halt, power-off or reboot the machine
sm-notify (8)        - send reboot notifications to NFS peers
sysctl.d (5)         - Configure kernel parameters at boot
systemd-backlight (8) - Load and save the display backlight brightness at boot and shutdown
[email protected] (8) - Load and save the display backlight brightness at boot and shutdown
systemd-binfmt (8)   - Configure additional binary formats for executables at boot
systemd-binfmt.service (8) - Configure additional binary formats for executables at boot
systemd-boot (7)     - A simple UEFI boot manager
systemd-debug-generator (8) - Generator for enabling a runtime debug shell and masking specific units at boot
systemd-firstboot (1) - Initialize basic system settings on or before the first boot-up of a system
systemd-firstboot.service (1) - Initialize basic system settings on or before the first boot-up of a system
systemd-modules-load (8) - Load kernel modules at boot
systemd-modules-load.service (8) - Load kernel modules at boot
systemd-random-seed (8) - Load and save the system random seed at boot and shutdown
systemd-random-seed.service (8) - Load and save the system random seed at boot and shutdown
systemd-rc-local-generator (8) - Compatibility generator for starting /etc/rc.local and /usr/sbin/halt.local during boot and shutdown
systemd-reboot.service (8) - System shutdown logic
systemd-rfkill (8)   - Load and save the RF kill switch state at boot and change
systemd-rfkill.service (8) - Load and save the RF kill switch state at boot and change
systemd-rfkill.socket (8) - Load and save the RF kill switch state at boot and change
systemd-sysctl (8)   - Configure kernel parameters at boot
systemd-sysctl.service (8) - Configure kernel parameters at boot
systemd-system-update-generator (8) - Generator for redirecting boot to offline update mode
systemd-update-utmp (8) - Write audit and utmp updates at bootup, runlevel changes and shutdown
systemd-update-utmp-runlevel.service (8) - Write audit and utmp updates at bootup, runlevel changes and shutdown
systemd-update-utmp.service (8) - Write audit and utmp updates at bootup, runlevel changes and shutdown
systemd-user-sessions (8) - Permit user logins after boot, prohibit user logins at shutdown
systemd-user-sessions.service (8) - Permit user logins after boot, prohibit user logins at shutdown
[student@workstation ~]$

7 使用man -k ext4来查找用于调整ext4文件系统参数的命令。

[student@workstation ~]$ man -k ext4
debugfs (8)          - ext2/ext3/ext4 file system debugger
dumpe2fs (8)         - dump ext2/ext3/ext4 filesystem information
e2fsck (8)           - check a Linux ext2/ext3/ext4 file system
e2image (8)          - Save critical ext2/ext3/ext4 filesystem metadata to a file
e2label (8)          - Change the label on an ext2/ext3/ext4 filesystem
e2mmpstatus (8)      - Check MMP status of an ext4 filesystem
e2undo (8)           - Replay an undo log for an ext2/ext3/ext4 filesystem
e4crypt (8)          - ext4 filesystem encryption utility
e4defrag (8)         - online defragmenter for ext4 filesystem
ext4 (5)             - the fourth extended file system
filesystems (5)      - Linux filesystem types: ext, ext2, ext3, ext4, hpfs, iso9660, JFS, minix, msdos, ncpfs nfs, ntfs, proc, Reiserfs, smb, sy...
fs (5)               - Linux filesystem types: ext, ext2, ext3, ext4, hpfs, iso9660, JFS, minix, msdos, ncpfs nfs, ntfs, proc, Reiserfs, smb, sy...
fsck.ext2 (8)        - check a Linux ext2/ext3/ext4 file system
fsck.ext3 (8)        - check a Linux ext2/ext3/ext4 file system
fsck.ext4 (8)        - check a Linux ext2/ext3/ext4 file system
fuse2fs (1)          - FUSE file system client for ext2/ext3/ext4 file systems
mke2fs (8)           - create an ext2/ext3/ext4 filesystem
mkfs.ext2 (8)        - create an ext2/ext3/ext4 filesystem
mkfs.ext3 (8)        - create an ext2/ext3/ext4 filesystem
mkfs.ext4 (8)        - create an ext2/ext3/ext4 filesystem
resize2fs (8)        - ext2/ext3/ext4 file system resizer
tune2fs (8)          - adjust tunable filesystem parameters on ext2/ext3/ext4 filesystems
[student@workstation ~]$

猜你喜欢

转载自blog.csdn.net/guolianggsta/article/details/130902905
今日推荐