Filters
Zo zoek je
  • Gewone woorden vinden namen, teksten en voorbeelden.
  • "twee woorden" vindt precies die zin.
  • --naam of -x vindt een optie.
  • #woord zoekt alleen in commando's.
  • @grep vindt lessen en labs die grep gebruiken.
  • Filters: cat:network · in:labs · in:notes · level:rhcsa · ch:8 · root:yes. Zet ! voor een woord om het weg te laten. OR tussen woorden betekent één ervan.
  • ↑ ↓ bewegen · Enter openen · Esc sluiten · / zoeken

Hoofdstuk 3Naam in de cursus: Getting Help from Local Documentation

Find help in the local documentation

A good admin does not remember every option. A good admin knows where to look. RHEL has the answers on the disk: man pages, --help, info pages and the files in /usr/share/doc. They also work when there is no internet — and in the exam.

  • 7 Lessen
  • 14 Commando's

Dit deel is nog niet vertaald. Je ziet de Engelse tekst.

$ als gewone gebruiker# als root (of met sudo)

Vaardigheden in dit hoofdstuk

  • Antwoorden vinden in man-pagina's, info en /usr/share/doc

3.1

Read a man page

man COMMAND opens the manual page of a command, a file or a function. It shows the syntax, every option and often examples.

man ls
man passwd
man 5 passwd
man -f passwd
passwd (1)           - update user's authentication tokens
passwd (5)           - password file

A man page has fixed parts:

PartWhat you find there
NAMEThe name and one line about it
SYNOPSISThe syntax. [ ] = optional, … = may repeat, | = choose one
DESCRIPTIONWhat it does, then the options
EXAMPLESReady command lines (not in every page)
FILESFiles the program reads or writes
SEE ALSORelated pages — a good path to more help

Keys inside man (they come from the pager less):

KeyWhat it does
Space / bOne page down / up
/word then EnterSearch forward; n = next match, N = previous
g / GGo to the start / the end
hHelp with all keys
qQuit

Examentip

Search the man page for EXAMPLE with /EXAMPLE. Many pages (for example man nmcli-examples, man 5 crontab) have ready lines you can copy.

3.2

Know the man page sections

The manual is split into numbered sections. The same name can exist in more sections — the number picks the right page.

SectionWhat is in itExample
1Commands for all usersman 1 passwd
5File formats and config filesman 5 passwd, man 5 fstab
8Admin commands (mostly for root)man 8 useradd
2, 3Kernel calls and library functions (for programmers)man 3 printf
7Overviews and standardsman 7 regex, man 7 signal
man 5 crontab
man 7 signal
man -a passwd

man -a shows all pages with that name, one after the other.

Onthoud

The number in passwd(5) is the section. Use it like this: man 5 passwd.

Commando's in deze les

3.3

Search the manual by keyword

When you do not know the command name, search the short descriptions: man -k WORD (same as apropos WORD).

man -k partition
fdisk (8)            - manipulate disk partition table
gdisk (8)            - Interactive GUID partition table (GPT) manipulator
parted (8)           - a partition manipulation program
partprobe (8)        - inform the OS of partition table changes
man -k '^user' | grep '(8)'
useradd (8)          - create a new user or update default new user information
userdel (8)          - delete a user account and related files
usermod (8)          - modify a user account
apropos -s 5 ssh

The search uses a database. If man -k finds nothing, or a new package is not found, build the database again:

mandb

Let op

man -k only searches the NAME line. Search for simple words: "partition", "password", "time zone".

3.4

Use --help and the shell's own help

Most commands print a short list of options with --help. Commands built into Bash (like cd) use help instead.

ls --help | less
nmcli connection modify --help
systemctl --help | grep -i enable
type cd
cd is a shell builtin
help cd
help -d export
export - Set export attribute for shell variables.

Op het werk

--help is faster than man when you only forgot one option. Pipe it into grep to find the line: rsync --help | grep -- --delete.

3.5

Read info pages

Some GNU tools have longer guides as info pages, with chapters and links.

info coreutils
info ls
pinfo coreutils
Key in infoWhat it does
Space / BackspacePage down / up
Tab, then EnterGo to the next link and open it
n / p / uNext / previous / up node
sSearch
qQuit

pinfo is an easier viewer with colors and links you can follow with the arrow keys (package pinfo).

Commando's in deze les

3.6

Look in /usr/share/doc

Packages put extra documentation in /usr/share/doc/PACKAGE/: example config files, read-me files and change logs.

ls /usr/share/doc | wc -l
412
ls /usr/share/doc/chrony/
ls /usr/share/doc/sudo/
rpm -qd openssh-server
/usr/share/doc/openssh-server/HOWTO.ssh-keycat
/usr/share/man/man5/sshd_config.5.gz
/usr/share/man/man8/sshd.8.gz

rpm -qd PACKAGE lists all documentation files of a package — man pages included.

3.7

Use the Red Hat documentation online

When the local help is not enough, Red Hat has full guides and a knowledge base.

  • docs.redhat.com — the product documentation for RHEL 10: installation, networking, storage, security … Free for everybody.
  • Red Hat Customer Portal (access.redhat.com) — knowledge-base articles and solutions for real problems; many need an account (the free developer account works).
  • RHEL Lightspeed — ask questions in plain words on the command line. See Get AI help with RHEL Lightspeed.

Onthoud

Look in this order: --help → man (and man -k) → /usr/share/doc → online docs. The first three always work, even without internet.

Commando's in deze les

Alle commando's in dit hoofdstuk