الفلاتر
طريقة البحث
  • الكلمات العادية تجد الأسماء والنصوص والأمثلة.
  • "كلمتان" تجد العبارة بالضبط.
  • --name أو -x تجد خيارًا.
  • #كلمة تبحث داخل الأوامر فقط.
  • @grep تجد الدروس والمعامل التي تستخدم grep.
  • الفلاتر: cat:network · in:labs · level:rhcsa · ch:8 · root:yes. ضع ! قبل كلمة لاستبعادها. OR بين الكلمات تعني إحداها.
  • ↑ ↓ للتنقل · Enter للفتح · Esc للإغلاق · / للبحث

man

Read the manual page of a command, a configuration file or a system call.

المستوى
امتحان RHCSA
المجموعة
الطرفية والمساعدة
يحتاج root
لا
الحزمة
man-db

هذا الجزء لم يُترجم بعد. أنت ترى النص الإنجليزي.

ماذا يفعل

Almost every command and config file has a manual page ("man page"). man NAME opens it in a pager (usually less). The pages are split into sections:

SectionContains
1Commands for all users
2, 3System calls and library functions (for programmers)
4Device files
5File formats and config files
7Overviews and conventions
8Commands for system administration (root)

When a name exists in several sections (like passwd = command and file), give the section number: man 5 passwd.

Inside the pager: /word searches, n goes to the next match, G goes to the end (often to EXAMPLES), q quits.

طريقة الكتابة

man [OPTIONS] [SECTION] PAGE ...
man -k KEYWORD
man -f PAGE
man -K TEXT

الخيارات 39

الأكثر استخدامًا

Find pages

-k, --apropos
Search the short descriptions of all pages (same as apropos).
-f, --whatis
Show the short description of a page (same as whatis).
-K, --global-apropos
Search the full text of all pages (slow).
-a, --all
Show all pages with this name, one after the other.
-w, --where, --path, --location
Print the file of the page instead of showing it.
-W, --where-cat, --location-cat
Print the file of the pre-formatted page.
-l, --local-file
Show a man page file from the disk (not from the database).
-S, -s, --sections=list
Search only these sections, like 5:8.
-e, --extension=sub
Only pages with this sub-extension.
-i, --ignore-case
Ignore upper/lower case (the default).
-I, --match-case
Match upper/lower case exactly.
--regex
Treat the names as regular expressions.
--wildcard
Treat the names as shell wildcards.
--names-only
With --regex or --wildcard: match only page names.
-u, --update
Update the cache before searching.
--no-subpages
Do not join names like git diff into git-diff.

Display

-P, --pager=pager
Use another pager program.
-r, --prompt=text
The prompt text of less.
-7, --ascii
Show pure ASCII.
-E, --encoding=enc
Output encoding.
--no-hyphenation, --nh
No hyphenation.
--no-justification, --nj
No text justification.
-p, --preprocessor=list
Preprocessors to run (like t = tables).
-t, --troff
Format the page for printing (PostScript).
-T, --troff-device[=<device>]
Format for another device.
-H, --html[=<browser>]
Show the page as HTML in a browser.
-X, --gxditview[=<dpi>]
Show the page in a graphical window.
-Z, --ditroff
Output for ditroff.

Settings

-C, --config-file=file
Use another configuration file.
-M, --manpath=path
Search pages in these folders.
-m, --systems=list
Search pages of other systems.
-L, --locale=locale
Use this language.
-R, --recode=enc
Convert the page to this encoding.
-c, --catman
Used by catman only.
-d, --debug
Print debug information.
-D, --default
Reset all options to the defaults.
--warnings[=<list>]
Show groff warnings.
-?, --help
Show help.
-V, --version
Show the version.

أمثلة 12

$ مستخدم عادي# بصلاحية root (أو مع sudo)

  1. 1Open the manual of a command

    man useradd

    Press / and type a word to search, n for the next match, q to quit.

  2. 2Open the manual of a config file

    man 5 fstab

    Section 5 explains the six columns of /etc/fstab. Very useful in the exam.

  3. 3Find the right command for a job

    man -k "logical volume"

    Lists every page that mentions it in its short description.

  4. 4Find only admin commands about a topic

    man -k partition | grep '(8)'

    Section 8 = commands for root, like fdisk and parted.

  5. 5See the short description only

    man -f passwd
    passwd (1)           - change user password
    passwd (5)           - the password file

    Two pages: the command (1) and the file format (5).

  6. 6Find where the page file is

    man -w sshd_config
    /usr/share/man/man5/sshd_config.5.gz

    Shows which package documentation you are reading.

  7. 7Jump straight to the examples

    man nmcli-examples

    Some tools have a separate examples page. For others, open the page and press G, then scroll up to EXAMPLES.

  8. 8Search all pages for a word in the text

    man -K "PermitRootLogin"

    Slow, but finds pages that mention a word anywhere.

  9. 9Read a man page file that came with a download

    man -l ./docs/mytool.1

    Works for any page file, also outside the system folders.

  10. 10Show all pages with the same name

    man -a crontab

    First crontab(1) (the command), then crontab(5) (the file format). Press q to go to the next one.

  11. 11Save a page as plain text for notes

    man ss | col -b > ss-manual.txt

    col -b removes the bold and underline codes.

  12. 12Read the systemd unit options

    man systemd.service

    The pages systemd.unit, systemd.service and systemd.timer explain every option of unit files.

انتبه

  • "nothing appropriate" from man -k usually means the search database is old or empty. Run mandb as root.
  • Minimal installs can miss man pages. Install the package man-pages and the documentation of the tool.

الملفات

/usr/share/man/
The man pages, one folder per section (man1, man5, man8 …).
/etc/man_db.conf
Settings of man and mandb.

نصائح للحفظ

  • 1 = user commands, 5 = files, 8 = admin commands.
  • man -k = I do not know the name. man NAME = I know the name.
  • In the pager: / search, n next, G end, q quit.