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

mandb

Build or update the search database of the man pages (used by man -k, apropos and whatis).

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

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

ماذا يفعل

man -k and apropos do not read every manual page; they search a small database with the short descriptions. mandb creates and updates that database.

On RHEL a timer updates it every day. But right after an install, or after you install new packages, the database can be empty or old. Then man -k says "nothing appropriate". Run mandb as root to fix it.

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

mandb [-dqsucpt?V] [-C FILE] [MANPATH]
mandb [-dqsut] [-C FILE] -f FILENAME ...

الخيارات 12

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

-c, --create
Build the databases from zero, even if they exist.
-q, --quiet
Only print warnings and errors.
-u, --user-db
Build only the database of your user, not the system databases.
-f, --filename file
Update only the entry of this one page file.
-s, --no-straycats
Do not look for formatted pages without a source.
-p, --no-purge
Do not remove entries of pages that were deleted.
-t, --test
Check the pages for problems; do not build a database.
-d, --debug
Print debug information.
-C, --config-file=file
Use another configuration file.
-?, --help
Show help.
--usage
Show a short usage message.
-V, --version
Show the version.

أمثلة 11

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

  1. 1Update the database

    mandb

    Takes a few seconds. After this, man -k finds new pages.

  2. 2Fix "nothing appropriate" from man -k

    man -k partition
    partition: nothing appropriate.
    mandb
    man -k partition

    Typical on a fresh system or in the exam: build the database once.

  3. 3Build everything from zero

    mandb -c

    Use it when the database seems broken.

  4. 4Update quietly in a script

    mandb -q

    Only errors are printed. Good after installing many packages.

  5. 5Update after you add your own man page

    cp mytool.8 /usr/local/share/man/man8/ && mandb -q
    man -k mytool

    Your page appears in the search.

  6. 6Update only the entry of one file

    mandb -f /usr/local/share/man/man8/mytool.8

    Faster than a full run.

  7. 7Build a database for your own pages (no root)

    mandb -u

    For pages in your home folder (for example in ~/.local/share/man).

  8. 8Check the pages for errors without changing anything

    mandb -t

    Reports broken or wrong pages.

  9. 9Check the timer that updates the database every day

    systemctl list-timers | grep man-db

    If the timer is missing or disabled, the database gets old.

  10. 10Update the database after a big dnf install in a template

    dnf install -y bind-utils nfs-utils && mandb -q

    A ready-to-use VM template should have a fresh man database.

  11. 11See which folders mandb indexes

    manpath

    Prints the folders that man and mandb use.

انتبه

  • mandb does not install man pages. If a page is missing, install the package that has it.
  • Run it as root to update the system databases.

الملفات

/var/cache/man/
The databases (index.db files).
/etc/man_db.conf
Which folders are indexed.

نصائح للحفظ

الدليل الكامل

هذه الصفحة تشرح الأمر بكلمات بسيطة. الدليل الأصلي فيه كل التفاصيل.

في الطرفية: man 8 mandb