Exploring /usr/share/doc and tldr for LFCS Certification

Discover hidden Linux documentation in /usr/share/doc with READMEs, examples, and changelogs. Master tldr for quick command examples. Build your complete documentation strategy for LFCS exam success.

35 min read

Welcome to Part 14 of the LFCS Certification - Phase 1 series! You've mastered man pages, info pages, and --help. Now let's uncover the hidden treasure trove of documentation in /usr/share/doc and discover tldr for lightning-fast command examples.

💡

🎯 What You'll Learn: In this comprehensive guide, you'll master:

  • What /usr/share/doc contains and why it matters
  • Navigating package documentation directories
  • Finding READMEs, examples, changelogs, and licenses
  • Reading compressed documentation with zcat, zless, zgrep
  • Understanding documentation organization by package
  • Installing and using tldr (Too Long; Didn't Read)
  • Comparing tldr vs man vs info vs --help
  • Building your complete documentation strategy
  • Finding configuration examples for real services
  • 20+ comprehensive practice labs with solutions

Series: LFCS Certification Preparation - Phase 1 (Post 14 of 52) Previous: Part 13 - Using info, pinfo, and --help Next: Part 15 - Understanding Network Interfaces with ip Command

Understanding /usr/share/doc

What is /usr/share/doc? A directory containing package-specific documentation installed alongside software packages on your Linux system.

Why /usr/share/doc Matters

Unlike man and info pages, /usr/share/doc contains:

  • README files - Installation notes, usage tips, getting started guides
  • Example configurations - Real working configuration file examples
  • Changelogs - Version history and what changed between releases
  • License files - Software licenses and legal information
  • HOWTOs - Step-by-step guides for specific tasks
  • Sample scripts - Actual code you can copy and modify
  • NEWS files - Important announcements about the package

💡 Pro Tip: When configuring a complex service like Apache, Nginx, or SSH, ALWAYS check /usr/share/doc/package-name/examples/ first! You'll often find complete, working configuration examples that save hours of trial and error.

Structure of /usr/share/doc

Each installed package gets its own subdirectory:

/usr/share/doc/
├── bash-5.1.8/
│   ├── CHANGES
│   ├── COMPAT
│   ├── FAQ
│   ├── INTRO
│   ├── NEWS
│   └── README
├── openssh-8.7p1/
│   ├── CREDITS
│   ├── LICENCE
│   ├── OVERVIEW
│   ├── PROTOCOL
│   └── README
├── sudo-1.9.5/
│   ├── CONTRIBUTORS
│   ├── HISTORY
│   ├── LICENSE
│   ├── NEWS
│   └── README
└── ... (hundreds more)

Key Points:

  • One directory per package
  • Directory name usually includes version number
  • Contains package-specific documentation files
  • Files often compressed with gzip (.gz extension)

Exploring /usr/share/doc

Listing Installed Package Documentation

# List all package documentation directories
ls /usr/share/doc/

Example output:

acl-2.3.1        bash-5.1.8       coreutils-8.32   grep-3.6
audit-3.0.7      bind-license     cronie-1.5.7     gzip-1.10
bash-completion  ca-certificates  dnf-4.14.0       htop-3.2.1

What this shows:

  • Each installed package with documentation
  • Version numbers included in directory names
  • Alphabetically sorted list
# Count how many packages have documentation
ls /usr/share/doc/ | wc -l

Example output:

437

Explanation:

  • This system has documentation for 437 packages
  • Not every installed package has /usr/share/doc entries
  • Only packages that provide additional docs beyond man pages

Finding Specific Package Documentation

# Find documentation for packages matching "ssh"
ls /usr/share/doc/ | grep ssh

Example output:

openssh-8.7p1
openssh-clients-8.7p1
openssh-server-8.7p1

What this tells you:

  • Three OpenSSH-related packages have documentation
  • All are version 8.7p1
  • Separate docs for client and server components

Viewing Package Documentation Contents

# See what's inside openssh documentation
ls /usr/share/doc/openssh-8.7p1/

Example output:

CREDITS  LICENCE  OVERVIEW  PROTOCOL  PROTOCOL.agent  PROTOCOL.certkeys  README

Files explained:

  • CREDITS - Contributors and acknowledgments
  • LICENCE - Legal terms (OpenSSH uses BSD license)
  • OVERVIEW - High-level description of SSH architecture
  • PROTOCOL* - Technical protocol specifications
  • README - General information and getting started

Reading Documentation Files

# Read the README file
cat /usr/share/doc/openssh-8.7p1/README

Example output:

This is the README file for OpenSSH.

Please refer to the INSTALL file for installation instructions.

OpenSSH is a free implementation of the Secure Shell protocol suite,
providing encrypted communication sessions over a computer network.

For more information see:
  https://www.openssh.com/

Why this matters:

  • Provides context about the package
  • Links to more resources
  • Often includes quick start guides
  • May reference other doc files

Working with Compressed Documentation

Many documentation files are compressed with gzip to save disk space. You'll see .gz extensions.

Tools for Reading Compressed Files

CommandPurposeLike Regular Command
zcatView compressed filescat
zlessPage through compressed filesless
zmorePage through compressed filesmore
zgrepSearch compressed filesgrep
zdiffCompare compressed filesdiff

Using zcat - View Compressed Files

# Find compressed documentation
ls /usr/share/doc/bash-5.1.8/

Example output:

CHANGES  COMPAT  FAQ  INTRO  NEWS  README

Let's say CHANGES is compressed:

# This won't work well - shows binary gibberish
cat /usr/share/doc/bash-5.1.8/CHANGES.gz

# Use zcat instead - decompresses and displays
zcat /usr/share/doc/bash-5.1.8/CHANGES.gz

How zcat works:

  • Decompresses the .gz file on-the-fly
  • Sends uncompressed content to stdout
  • Original file remains compressed
  • No temporary files created

Using zless - Page Through Compressed Files

# Page through a compressed changelog
zless /usr/share/doc/bash-5.1.8/CHANGES.gz

Navigation (same as less):

  • Space - Next page
  • b - Previous page
  • /pattern - Search forward
  • ?pattern - Search backward
  • q - Quit

Why use zless?

  • Long files are easier to read
  • Can search within the file
  • More comfortable than scrolling through zcat output

Using zgrep - Search Compressed Files

# Search for "security" in compressed changelog
zgrep -i security /usr/share/doc/bash-5.1.8/CHANGES.gz

Example output:

  - Fixed a security issue with array variable handling
  - Security patch for command injection vulnerability
  - Improved security of restricted shell mode

Command breakdown:

  • zgrep - grep for compressed files
  • -i - case-insensitive search
  • security - pattern to search for
  • .gz file - compressed documentation

Use cases:

  • Finding security-related changes in changelogs
  • Searching for specific features or bug fixes
  • Locating configuration examples

Real-World Example: Finding Configuration Examples

Let's say you need to configure sudo and want to see examples:

# Step 1: Find sudo documentation
ls /usr/share/doc/ | grep sudo

Output:

sudo-1.9.5
# Step 2: Explore what's available
ls /usr/share/doc/sudo-1.9.5/

Output:

CONTRIBUTORS  examples/  HISTORY  LICENSE  NEWS  README  UPGRADE

Notice the examples/ directory!

# Step 3: See what examples exist
ls /usr/share/doc/sudo-1.9.5/examples/

Output:

pam.conf  sudo.conf  sudoers  syslog.conf
# Step 4: View an example sudoers file
cat /usr/share/doc/sudo-1.9.5/examples/sudoers

You'll see a working example sudoers configuration with:

  • Commented explanations
  • Best practice configurations
  • Security recommendations
  • Real-world scenarios

💡 LFCS Exam Tip: During the exam, if you need to configure a service you're unsure about, check /usr/share/doc/package-name/examples/ before man pages. Examples are faster and show working configurations!

Introducing tldr - Too Long; Didn't Read

While man pages are comprehensive, sometimes you just want quick examples. That's where tldr comes in.

What is tldr?

tldr is a community-driven documentation project that provides simplified, example-focused help pages for common commands.

Philosophy:

  • Show practical examples first
  • Skip lengthy explanations
  • Focus on common use cases
  • Colorful, easy-to-scan format

Comparing man vs tldr

man ls (traditional):

LS(1)                     User Commands                    LS(1)

NAME
       ls - list directory contents

SYNOPSIS
       ls [OPTION]... [FILE]...

DESCRIPTION
       List  information  about  the FILEs (the current directory by
       default).  Sort entries alphabetically if none of -cftuvSUX nor
       --sort is specified.

       Mandatory arguments to long options are mandatory for short
       options too.

       -a, --all
              do not ignore entries starting with .

       -l     use a long listing format

       ... (hundreds more lines)

tldr ls (simplified):

ls
List directory contents.

- List files one per line:
  ls -1

- List all files, including hidden files:
  ls -a

- Long format list with permissions, ownership, size, and date:
  ls -la

- Long format with human-readable file sizes:
  ls -lh

- List files sorted by size (descending):
  ls -S

Key differences:

  • tldr shows examples immediately
  • man shows complete documentation
  • tldr is faster for common tasks
  • man is required for advanced options

Installing tldr

Method 1: npm (Node Package Manager)

# Install Node.js and npm first (if not installed)
sudo dnf install nodejs npm -y  # CentOS/RHEL
# OR
sudo apt install nodejs npm -y  # Ubuntu/Debian

# Install tldr globally
sudo npm install -g tldr

Verify installation:

tldr --version

Example output:

tldr 3.3.7

Method 2: Python pip

# Install Python pip first (if not installed)
sudo dnf install python3-pip -y  # CentOS/RHEL
# OR
sudo apt install python3-pip -y  # Ubuntu/Debian

# Install tldr
sudo pip3 install tldr

Method 3: Package Manager (if available)

# Some distributions have tldr in repositories
sudo dnf install tldr -y  # May not be available
# OR
sudo apt install tldr -y  # May not be available
⚠️

⚠️ First Run: The first time you run tldr, it downloads the tldr page database. This is normal and only happens once. Updates are automatic or can be triggered with tldr --update.

Using tldr

Basic Usage

# Get quick examples for any command
tldr command_name

Example with tar:

tldr tar

Output:

tar
Archiving utility.

- Create an archive from files:
  tar cf target.tar file1 file2 file3

- Extract an archive:
  tar xf source.tar

- Create a gzipped archive:
  tar czf target.tar.gz file1 file2

- Extract a gzipped archive:
  tar xzf source.tar.gz

- List contents of an archive:
  tar tf source.tar

Why this is helpful:

  • Shows the most common tar operations
  • Includes the exact syntax
  • No need to remember compression flags
  • Covers 90% of daily use cases

Updating the tldr Database

# Update to get latest pages
tldr --update

When to update:

  • After installing tldr for the first time
  • Monthly or when you need newer docs
  • When a command page seems outdated

Searching for Commands

# List all available pages
tldr --list

Output (partial):

7z
7za
ab
ack
acpi
adduser
...
# Search for specific topics
tldr --list | grep network

Building Your Documentation Strategy

Now that you know all four documentation methods, here's when to use each:

Linux Documentation Decision Flow

Need quick examples?

Use tldr first

Need complete options?

Use man pages

Need config examples?

Check /usr/share/doc

Need guided tutorial?

Use info pages (GNU tools)

Need quick reminder?

Use --help or -h

The Complete Documentation Workflow

Scenario: You need to use rsync but don't remember the syntax

Step 1: Quick examples (tldr)

tldr rsync
  • Takes 5 seconds
  • Shows common use cases
  • Might be all you need

Step 2: If you need more (man page)

man rsync
  • Complete option list
  • Detailed explanations
  • All edge cases covered

Step 3: For configuration files (man section 5)

man 5 rsync.conf  # if applicable

Step 4: For real examples (/usr/share/doc)

ls /usr/share/doc/rsync*/examples/
  • Working configuration files
  • Real-world scripts
  • Copy and modify approach
💡

💡 Pro Workflow: Start with tldr for speed. If you need more details, graduate to man pages. For complex configurations, check /usr/share/doc for examples. This three-tier approach saves massive amounts of time!

Comparison Table: All Documentation Methods

MethodBest ForSpeedDepthLFCS Exam
tldrQuick examples, common tasks⚡ FastestShallowNot available
--helpQuick option list⚡ Very fastBrief✅ Available
man pagesComplete reference, all options⏱️ ModerateComplete✅ Available
/usr/share/docConfig examples, real files⏱️ ModeratePractical✅ Available
info pagesGNU tool tutorials⏳ SlowVery deep✅ Available

🧪 Practice Labs

Time to practice! These labs will help you master /usr/share/doc and tldr.

⚠️

⚠️ Before Starting: Make sure you have some packages installed on your system. If you're on a minimal installation, install a few packages with documentation first:

sudo dnf install bash-completion httpd nginx -y  # CentOS/RHEL
# OR
sudo apt install bash-completion apache2 nginx -y  # Ubuntu/Debian

Lab 1: Exploring /usr/share/doc (Beginner)

Task 1.1: List all package documentation on your system

ls /usr/share/doc/
Solution & Explanation
[centos9@centos ~]$ ls /usr/share/doc/
acl-2.3.1  bash-5.1.8  coreutils-8.32  grep-3.6  openssh-8.7p1  sudo-1.9.5

What you see:

  • Each directory represents a package
  • Version numbers are included
  • Alphabetically sorted

Key point: This shows ALL packages that installed documentation. Not every package does!

Task 1.2: Count how many packages have documentation

ls /usr/share/doc/ | wc -l
Solution & Explanation
[centos9@centos ~]$ ls /usr/share/doc/ | wc -l
437

Explanation:

  • ls /usr/share/doc/ - list all doc directories
  • | - pipe the output to next command
  • wc -l - count lines (each directory is one line)
  • Result: 437 packages with documentation

Your number will vary based on what's installed!

Task 1.3: Find all packages related to "network"

ls /usr/share/doc/ | grep -i network
Solution & Explanation
[centos9@centos ~]$ ls /usr/share/doc/ | grep -i network
NetworkManager-1.36.0
network-scripts-10.11

Explanation:

  • grep -i network - case-insensitive search for "network"
  • Shows NetworkManager and network-scripts packages
  • Both have documentation available

Use case: Finding docs for networking-related packages.

Lab 2: Reading Documentation Files (Beginner)

Task 2.1: Explore what documentation bash provides

ls /usr/share/doc/bash*/
Solution & Explanation
[centos9@centos ~]$ ls /usr/share/doc/bash-5.1.8/
CHANGES  COMPAT  FAQ  INTRO  NEWS  README

Files explained:

  • CHANGES - What changed between versions
  • COMPAT - Compatibility information
  • FAQ - Frequently Asked Questions
  • INTRO - Introduction to bash
  • NEWS - Important announcements
  • README - Getting started

Pro tip: Always read README first!

Task 2.2: Read the bash README file

cat /usr/share/doc/bash*/README
Solution & Explanation
[centos9@centos ~]$ cat /usr/share/doc/bash-5.1.8/README
Introduction
============

This is GNU bash, version 5.1.  Bash is the GNU Project's Bourne
Again SHell, a complete implementation of the POSIX shell spec...

What you learn:

  • Version information
  • What bash is
  • Links to more resources
  • Basic getting started info

Key takeaway: README files provide context and overview.

Task 2.3: View the bash FAQ (using less for paging)

less /usr/share/doc/bash*/FAQ
Solution & Explanation
[centos9@centos ~]$ less /usr/share/doc/bash-5.1.8/FAQ

Navigation:

  • Space - next page
  • b - previous page
  • / - search
  • q - quit

What you find:

  • Common bash questions and answers
  • Troubleshooting tips
  • Known issues and workarounds

LFCS tip: FAQ files are goldmines for troubleshooting during the exam!

Lab 3: Working with Compressed Documentation (Intermediate)

Task 3.1: Find compressed files in documentation

find /usr/share/doc/bash*/ -name "*.gz"
Solution & Explanation
[centos9@centos ~]$ find /usr/share/doc/bash-5.1.8/ -name "*.gz"
/usr/share/doc/bash-5.1.8/CHANGES.gz
/usr/share/doc/bash-5.1.8/NEWS.gz

Explanation:

  • find - search for files
  • /usr/share/doc/bash-5.1.8/ - directory to search
  • -name "*.gz" - files ending in .gz
  • Found CHANGES and NEWS compressed

Why compressed? These are large files. Compression saves disk space.

Task 3.2: View compressed CHANGES file with zcat

zcat /usr/share/doc/bash*/CHANGES.gz | head -20
Solution & Explanation
[centos9@centos ~]$ zcat /usr/share/doc/bash-5.1.8/CHANGES.gz | head -20
This document details the changes between this version, bash-5.1,
and the previous version, bash-5.0.

1. Changes to Bash

a. Fixed a bug that caused the SIGINT handler to be removed when in a
   background job that exited, which prevented the parent shell from
   handling SIGINT.
...

Command breakdown:

  • zcat - decompress and output to stdout
  • | - pipe to next command
  • head -20 - show first 20 lines
  • Without head, would show entire file (very long!)

Key skill: Reading compressed docs without decompressing the file.

Task 3.3: Page through compressed file with zless

zless /usr/share/doc/bash*/CHANGES.gz
Solution & Explanation

Navigation (same as less):

  • Space - next page
  • b - previous page
  • /pattern - search forward
  • q - quit

Why zless instead of zcat?

  • Better for long files
  • Can navigate back and forth
  • Can search within the file
  • More comfortable reading experience

Use case: Reading long changelogs or NEWS files.

Task 3.4: Search for "security" in compressed changelog

zgrep -i "security" /usr/share/doc/bash*/CHANGES.gz
Solution & Explanation
[centos9@centos ~]$ zgrep -i "security" /usr/share/doc/bash-5.1.8/CHANGES.gz
a. Fixed a security issue with array variable handling
b. Security patch for command injection vulnerability

Command breakdown:

  • zgrep - grep for compressed files
  • -i - case-insensitive
  • "security" - search pattern
  • Shows all lines matching "security"

LFCS use case: Quickly finding security fixes in package changelogs!

Lab 4: Finding Configuration Examples (Intermediate)

Task 4.1: Check if openssh has example configurations

ls /usr/share/doc/openssh*/
Solution & Explanation
[centos9@centos ~]$ ls /usr/share/doc/openssh-8.7p1/
CREDITS  LICENCE  OVERVIEW  PROTOCOL  PROTOCOL.agent  README

What we see:

  • No examples/ directory here (common for openssh)
  • Has other useful docs: OVERVIEW, PROTOCOL
  • Different packages structure docs differently

Note: Not all packages have examples/ directories, but when they do, they're invaluable!

Task 4.2: Find packages that have examples directories

find /usr/share/doc/ -type d -name "examples" | head -10
Solution & Explanation
[centos9@centos ~]$ find /usr/share/doc/ -type d -name "examples" | head -10
/usr/share/doc/sudo-1.9.5/examples
/usr/share/doc/logrotate-3.18.0/examples
/usr/share/doc/rsyslog-8.2102.0/examples
/usr/share/doc/httpd-2.4.51/examples

Command breakdown:

  • find /usr/share/doc/ - search in doc directory
  • -type d - only directories
  • -name "examples" - named "examples"
  • head -10 - first 10 results

Discovery: sudo, logrotate, rsyslog, httpd all have examples!

Task 4.3: Explore sudo examples

ls /usr/share/doc/sudo*/examples/
Solution & Explanation
[centos9@centos ~]$ ls /usr/share/doc/sudo-1.9.5/examples/
pam.conf  sudo.conf  sudoers  syslog.conf

What we found:

  • sudoers - example sudoers file
  • sudo.conf - example sudo configuration
  • pam.conf - PAM configuration example
  • syslog.conf - logging configuration

Value: These are WORKING examples you can copy and modify!

Task 4.4: View the example sudoers file

cat /usr/share/doc/sudo*/examples/sudoers | head -30
Solution & Explanation
[centos9@centos ~]$ cat /usr/share/doc/sudo-1.9.5/examples/sudoers | head -30
##
## Sample sudoers file
##
## This file MUST be edited with the 'visudo' command as root.
##
## See the man page for details on how to write a sudoers file.
##

##
## Host alias specification
##
## Groups of machines...

What you get:

  • Real working configuration
  • Comments explaining each section
  • Best practices built-in
  • Safe to copy and modify

LFCS exam tip: This saves you from writing configs from scratch!

Lab 5: Installing and Using tldr (Intermediate)

Task 5.1: Install tldr using npm (if not already installed)

# Install Node.js and npm first
sudo dnf install nodejs npm -y

# Install tldr globally
sudo npm install -g tldr
Solution & Explanation
[centos9@centos ~]$ sudo dnf install nodejs npm -y
Last metadata expiration check: 0:05:23 ago on Tue 05 Nov 2025.
Dependencies resolved.
===========================================
 Package       Arch    Version    Repository   Size
===========================================
Installing:
 nodejs        x86_64  16.14.0    appstream    12 M
 npm           x86_64  8.3.1      appstream    2.1 M
...

[centos9@centos ~]$ sudo npm install -g tldr
/usr/bin/tldr -> /usr/lib/node_modules/tldr/bin/tldr
+ tldr@3.3.7
added 35 packages in 3.821s

Steps:

  1. Install Node.js and npm (required for tldr)
  2. Use npm to install tldr globally (-g flag)
  3. tldr is now available system-wide

Verify:

tldr --version

Task 5.2: Get quick examples for the tar command

tldr tar
Solution & Explanation
[centos9@centos ~]$ tldr tar

  tar
  Archiving utility.
  Often combined with a compression method, such as gzip or bzip2.
  More information: https://www.gnu.org/software/tar.

  - Create an archive from files:
    tar cf target.tar file1 file2 file3

  - Create a gzipped archive:
    tar czf target.tar.gz file1 file2 file3

  - Extract an archive:
    tar xf source.tar

  - Extract a gzipped archive:
    tar xzf source.tar.gz

  - Extract an archive to a specific directory:
    tar xf source.tar -C /path/to/directory

  - List the contents of a tar file:
    tar tf source.tar

Why this is awesome:

  • Shows most common tar operations
  • Exact syntax included
  • No need to parse lengthy man page
  • Covers 90% of daily use cases

Comparison: Try man tar and see how much longer it is!

Task 5.3: Compare tldr vs man for the find command

# First try tldr
tldr find

# Then compare with man
man find
Solution & Explanation

tldr find (short and sweet):

find
Find files or directories under the given directory tree, recursively.

- Find files by extension:
  find root_path -name '*.ext'

- Find files by matching multiple patterns:
  find root_path -name '*pattern_1*' -or -name '*pattern_2*'

- Find directories:
  find root_path -type d

- Find files modified in the last 7 days:
  find root_path -mtime -7

man find (comprehensive):

  • 20+ pages of options
  • Every possible flag explained
  • Complex examples
  • Complete reference

When to use which:

  • tldr find → Quick reminder of common operations
  • man find → Need specific, advanced option

Best practice: Start with tldr, graduate to man if needed.

Task 5.4: Update tldr database

tldr --update
Solution & Explanation
[centos9@centos ~]$ tldr --update
✓ Successfully updated cache

What this does:

  • Downloads latest tldr pages from repository
  • Updates your local cache
  • Ensures you have newest documentation

When to update:

  • After first installation
  • Monthly for maintenance
  • When a page seems outdated
  • Before important work (like LFCS exam prep)

Lab 6: Documentation Detective Work (Advanced)

Task 6.1: Find documentation for the package that provides SELinux tools

# Find selinux related packages
ls /usr/share/doc/ | grep -i selinux
Solution & Explanation
[centos9@centos ~]$ ls /usr/share/doc/ | grep -i selinux
libselinux-3.3
libselinux-utils-3.3
selinux-policy-3.14.3
selinux-policy-targeted-3.14.3

Found multiple SELinux packages:

  • libselinux - SELinux library
  • libselinux-utils - SELinux utilities
  • selinux-policy - SELinux policy
  • selinux-policy-targeted - Targeted policy

Next: Explore each to find what you need.

Task 6.2: Find which package has the most documentation files

for dir in /usr/share/doc/*/; do
  echo -n "$(basename "$dir"): "
  find "$dir" -type f | wc -l
done | sort -t: -k2 -nr | head -5
Solution & Explanation
[centos9@centos ~]$ for dir in /usr/share/doc/*/; do
  echo -n "$(basename "$dir"): "
  find "$dir" -type f | wc -l
done | sort -t: -k2 -nr | head -5

httpd-2.4.51: 127
kernel-5.14.0: 89
selinux-policy-targeted-3.14.3: 67
python3-3.9.9: 45
bash-5.1.8: 23

Command breakdown:

  • for dir in /usr/share/doc/*/ - loop through each directory
  • basename "$dir" - get directory name without path
  • find "$dir" -type f | wc -l - count files in directory
  • sort -t: -k2 -nr - sort by count (descending)
  • head -5 - show top 5

Discovery: httpd (Apache) has the most documentation (127 files)!

Task 6.3: Find all README files in /usr/share/doc

find /usr/share/doc/ -name "README*" -type f | wc -l
Solution & Explanation
[centos9@centos ~]$ find /usr/share/doc/ -name "README*" -type f | wc -l
312

What this shows:

  • 312 packages include README files
  • README is the most common doc file
  • Always start by reading the README

Tip: To see which packages:

find /usr/share/doc/ -name "README*" -type f | head -10

Lab 7: Building Documentation Workflows (Advanced)

Task 7.1: Create a workflow to learn about the rsync command

# Step 1: Quick examples with tldr
tldr rsync

# Step 2: If you need more, check man page
man rsync

# Step 3: Look for configuration examples
ls /usr/share/doc/rsync*/examples/ 2>/dev/null

# Step 4: Read any README
cat /usr/share/doc/rsync*/README* 2>/dev/null | head -20
Solution & Explanation

Step 1: tldr rsync

rsync
Transfer files to or from a remote host (but not between two remote hosts).

- Transfer a file:
  rsync path/to/source path/to/destination

- Transfer with archive mode (preserves permissions, ownership, etc.):
  rsync -a path/to/source path/to/destination

- Transfer with compression:
  rsync -az path/to/source path/to/destination

Result: Got basic syntax quickly!

Step 2: man rsync

  • Complete option reference
  • Advanced use cases
  • All flags explained

Step 3: Look for examples

ls /usr/share/doc/rsync*/examples/
# May or may not exist

Step 4: Read README

cat /usr/share/doc/rsync*/README

Workflow summary:

  1. tldr → Quick start (30 seconds)
  2. man → Deep dive if needed (5 minutes)
  3. examples → Real configs (2 minutes to find)
  4. README → Context and overview (2 minutes)

Total time: Under 10 minutes to master any command!

Task 7.2: Document your findings about the systemd package

# Explore systemd documentation
ls /usr/share/doc/systemd*/
Solution & Explanation
[centos9@centos ~]$ ls /usr/share/doc/systemd-250/
20-yama-ptrace.conf  CODING_STYLE  LICENSE.GPL2  NEWS  README  UIDS-GIDS.md

What's available:

  • README - Overview of systemd
  • NEWS - Recent changes
  • CODING_STYLE - For developers
  • LICENSE.GPL2 - License information
  • UIDS-GIDS.md - User/Group ID conventions

Key files to read:

# Start with README
cat /usr/share/doc/systemd-250/README

# Check recent changes
less /usr/share/doc/systemd-250/NEWS

# Learn about UID/GID conventions
cat /usr/share/doc/systemd-250/UIDS-GIDS.md

Why this matters: systemd is critical for LFCS. Understanding its documentation structure helps troubleshoot service issues.

Lab 8: Compressed File Operations (Advanced)

Task 8.1: Find the 5 largest compressed documentation files

find /usr/share/doc/ -name "*.gz" -type f -exec ls -lh {} \; | sort -k5 -hr | head -5
Solution & Explanation
[centos9@centos ~]$ find /usr/share/doc/ -name "*.gz" -type f -exec ls -lh {} \; | sort -k5 -hr | head -5
-rw-r--r--. 1 root root 1.2M Oct 15 10:23 /usr/share/doc/bash-5.1.8/CHANGES.gz
-rw-r--r--. 1 root root 856K Oct 15 10:23 /usr/share/doc/systemd-250/NEWS.gz
-rw-r--r--. 1 root root 432K Oct 12 09:15 /usr/share/doc/kernel-5.14.0/changelog.gz
-rw-r--r--. 1 root root 287K Oct 10 11:45 /usr/share/doc/python3-3.9.9/NEWS.gz
-rw-r--r--. 1 root root 156K Sep 28 14:32 /usr/share/doc/httpd-2.4.51/CHANGES.gz

Command breakdown:

  • find /usr/share/doc/ -name "*.gz" - find .gz files
  • -exec ls -lh {} \; - run ls on each file
  • sort -k5 -hr - sort by 5th column (size), human-readable, reverse
  • head -5 - top 5 results

Observation: bash CHANGES is 1.2MB compressed! Must be huge uncompressed.

Task 8.2: Compare compressed vs uncompressed size

# Check compressed size
ls -lh /usr/share/doc/bash*/CHANGES.gz

# Check uncompressed size
zcat /usr/share/doc/bash*/CHANGES.gz | wc -c | numfmt --to=iec
Solution & Explanation
[centos9@centos ~]$ ls -lh /usr/share/doc/bash-5.1.8/CHANGES.gz
-rw-r--r--. 1 root root 1.2M Oct 15 10:23 /usr/share/doc/bash-5.1.8/CHANGES.gz

[centos9@centos ~]$ zcat /usr/share/doc/bash-5.1.8/CHANGES.gz | wc -c | numfmt --to=iec
5.8M

Results:

  • Compressed: 1.2M
  • Uncompressed: 5.8M
  • Compression ratio: ~5:1

Why this matters:

  • Compression saves significant disk space
  • 437 packages × average compression = GBs saved
  • That's why z* tools exist!

Commands explained:

  • zcat file.gz | wc -c - count bytes uncompressed
  • numfmt --to=iec - convert bytes to human-readable (K, M, G)

Task 8.3: Search all compressed changelogs for "CVE" (security vulnerabilities)

find /usr/share/doc/ -name "*CHANGE*.gz" -exec zgrep -l "CVE" {} \;
Solution & Explanation
[centos9@centos ~]$ find /usr/share/doc/ -name "*CHANGE*.gz" -exec zgrep -l "CVE" {} \;
/usr/share/doc/bash-5.1.8/CHANGES.gz
/usr/share/doc/openssh-8.7p1/CHANGES.gz
/usr/share/doc/sudo-1.9.5/CHANGES.gz

Command breakdown:

  • find /usr/share/doc/ -name "*CHANGE*.gz" - find changelog files
  • -exec zgrep -l "CVE" {} \; - search for "CVE" in each
  • -l flag shows only filenames with matches

Real-world use case: Security auditing! Finding which packages had CVE fixes.

Follow-up: View specific CVEs:

zgrep "CVE" /usr/share/doc/bash-5.1.8/CHANGES.gz

Lab 9: Real-World Scenarios (Advanced)

Task 9.1: You need to configure Apache httpd. Find example configurations.

# Step 1: Find httpd documentation
ls /usr/share/doc/ | grep httpd

# Step 2: Check for examples
ls /usr/share/doc/httpd*/

# Step 3: Look for config examples
find /usr/share/doc/httpd*/ -name "*.conf*"
Solution & Explanation
[centos9@centos ~]$ ls /usr/share/doc/ | grep httpd
httpd-2.4.51

[centos9@centos ~]$ ls /usr/share/doc/httpd-2.4.51/
ABOUT_APACHE  CHANGES  httpd-manual/  LICENSE  NOTICE  README  VERSIONING

[centos9@centos ~]$ find /usr/share/doc/httpd-2.4.51/ -name "*.conf*"
# Results will vary, but look for example configs

Key findings:

  • httpd has extensive documentation
  • httpd-manual/ directory with full manual
  • CHANGES shows version history
  • Look in /etc/httpd/ for actual config files

LFCS tip: Apache config examples are usually in /etc/httpd/conf.d/ rather than /usr/share/doc, but README will tell you this!

Task 9.2: You're debugging SSH issues. Find SSH protocol documentation.

# Find OpenSSH docs
ls /usr/share/doc/openssh*/

# Read protocol documentation
cat /usr/share/doc/openssh*/PROTOCOL | head -50
Solution & Explanation
[centos9@centos ~]$ ls /usr/share/doc/openssh-8.7p1/
CREDITS  LICENCE  OVERVIEW  PROTOCOL  PROTOCOL.agent  PROTOCOL.certkeys  README

[centos9@centos ~]$ cat /usr/share/doc/openssh-8.7p1/PROTOCOL | head -50
This documents OpenSSH's deviations and extensions to the published SSH
protocol.

OpenSSH implements the following SSH protocol versions:

SSH protocol version 1 (no longer supported)
SSH protocol version 2 (supported)

...

What you learn:

  • SSH protocol version information
  • OpenSSH-specific extensions
  • Protocol deviations from standard
  • Technical implementation details

When you need this: Debugging connection issues, understanding key exchange, configuring advanced SSH features.

Task 9.3: You need to understand logrotate. Build complete documentation picture.

# Step 1: Quick examples
tldr logrotate

# Step 2: Find examples
ls /usr/share/doc/logrotate*/examples/

# Step 3: View man page for complete reference
man logrotate

# Step 4: Check README
cat /usr/share/doc/logrotate*/README*
Solution & Explanation

Step 1: tldr logrotate

logrotate
Rotates, compresses, and mails system logs.

- Trigger a run manually:
  logrotate /etc/logrotate.conf

- Run with verbose output:
  logrotate -v /etc/logrotate.conf

- Dry run (test without making changes):
  logrotate -d /etc/logrotate.conf

Got basics in 10 seconds!

Step 2: Examples

ls /usr/share/doc/logrotate-3.18.0/examples/
# Should show example config files

Step 3: man page

man logrotate
# Complete reference: all options, rotation strategies, compression methods

Step 4: README

cat /usr/share/doc/logrotate-3.18.0/README
# Context: what logrotate does, why it exists, basic usage

Complete workflow time: 5 minutes to go from zero to confident!

Lab 10: Creating Your Documentation Library (Challenge)

Task 10.1: Create a personal reference of the most useful package documentation

# Create a documentation directory
mkdir -p ~/lfcs-docs

# Copy important READMEs
for pkg in bash sudo openssh systemd; do
  find /usr/share/doc/ -name "$pkg*" -type d -exec cp {}/README ~/lfcs-docs/README-$pkg 2>/dev/null \;
done

# List your collection
ls -lh ~/lfcs-docs/
Solution & Explanation
[centos9@centos ~]$ mkdir -p ~/lfcs-docs

[centos9@centos ~]$ for pkg in bash sudo openssh systemd; do
  find /usr/share/doc/ -name "$pkg*" -type d -exec cp {}/README ~/lfcs-docs/README-$pkg 2>/dev/null \;
done

[centos9@centos ~]$ ls -lh ~/lfcs-docs/
total 48K
-rw-r--r--. 1 centos9 centos9 3.2K Nov 05 14:23 README-bash
-rw-r--r--. 1 centos9 centos9 5.1K Nov 05 14:23 README-openssh
-rw-r--r--. 1 centos9 centos9 2.8K Nov 05 14:23 README-sudo
-rw-r--r--. 1 centos9 centos9 4.5K Nov 05 14:23 README-systemd

What you created:

  • Personal documentation library
  • Quick reference for important packages
  • Offline access to critical info

Expand this:

# Add more packages
for pkg in httpd nginx postgresql; do
  find /usr/share/doc/ -name "$pkg*" -type d -exec cp {}/README ~/lfcs-docs/README-$pkg 2>/dev/null \;
done

LFCS prep tip: Build this library for packages you'll need on the exam!

📚 Best Practices

Documentation Hierarchy for LFCS

1. Start with tldr (30 seconds)

  • Quick command examples
  • Common use cases covered
  • Fast syntax reminder

2. Use --help for quick reference (10 seconds)

  • Brief option list
  • Quick reminder of flags
  • No navigation needed

3. Check /usr/share/doc for examples (2 minutes)

  • Working configuration files
  • Real-world scripts
  • Package-specific details

4. Deep dive with man pages (5-15 minutes)

  • Complete option reference
  • All edge cases
  • Detailed explanations

5. Tutorial mode with info (15-30 minutes)

  • Comprehensive guides
  • GNU tool tutorials
  • Interactive learning

When Configuring New Services

Step 1: Check for examples first

ls /usr/share/doc/package-name*/examples/

Step 2: Read the README

cat /usr/share/doc/package-name*/README

Step 3: Copy example, don't start from scratch

cp /usr/share/doc/package-name/examples/config.conf /etc/package-name/

Step 4: Modify the example

vim /etc/package-name/config.conf

Step 5: Check man page for specific options

man 5 config-file-name  # Section 5 for config files

💡 Pro Tip: This workflow saves hours. Example files are tested, documented, and follow best practices. Starting from scratch invites errors!

For LFCS Exam

Time-saving strategies:

  1. Memorize common /usr/share/doc locations

    • /usr/share/doc/sudo*/examples/sudoers
    • /usr/share/doc/openssh*/README
    • /usr/share/doc/httpd*/README
  2. Use z tools confidently*

    • zless for reading long changelogs
    • zgrep for finding specific info
    • zcat | head for previewing
  3. Combine with man pages

    • Example from /usr/share/doc
    • Option details from man page
    • Best of both worlds
  4. Create quick aliases (practice system)

    alias doc='cd /usr/share/doc && ls'
    alias docgrep='ls /usr/share/doc | grep'
    

Documentation Maintenance

Keep documentation current:

# Update tldr database monthly
tldr --update

# Check for new documentation after package updates
sudo dnf update -y
ls -lt /usr/share/doc/ | head -10  # See recently updated docs

Create documentation notes:

# Personal notes directory
mkdir -p ~/docs-notes

# Add notes as you learn
echo "rsync -avz for archive + verbose + compression" >> ~/docs-notes/rsync-tips.txt

🚨 Common Pitfalls to Avoid

Pitfall 1: Ignoring /usr/share/doc Entirely

Problem: Many sysadmins never explore /usr/share/doc, missing valuable examples.

Solution: Make it a habit. When installing a new package, immediately check:

ls /usr/share/doc/package-name*/

Pitfall 2: Forgetting to Use z* Tools

Problem: Trying to read compressed files directly:

cat /usr/share/doc/bash-5.1.8/CHANGES.gz  # Shows gibberish!

Solution: Use the z-prefixed versions:

zcat /usr/share/doc/bash-5.1.8/CHANGES.gz  # Works perfectly!

Pitfall 3: Assuming tldr is Always Available

Problem: Relying on tldr during LFCS exam (it won't be installed).

Solution:

  • Use tldr for practice and learning
  • Know how to use man pages for the exam
  • Practice both methods

Pitfall 4: Not Reading READMEs First

Problem: Diving into complex docs without context.

Solution: Always start with README:

cat /usr/share/doc/package-name*/README | less

It provides context that makes other docs make sense.

Pitfall 5: Copying Examples Without Understanding

Problem: Copying example configs blindly without understanding.

Solution:

  1. Copy the example
  2. Read comments in the file
  3. Check man page for options you don't understand
  4. Test incrementally

Pitfall 6: Forgetting Documentation Versions

Problem: Looking at old documentation for updated software.

Solution: Always check version numbers:

ls -l /usr/share/doc/ | grep package-name
# Version number is in directory name

📝 Command Cheat Sheet

/usr/share/doc Commands

# List all package documentation
ls /usr/share/doc/

# Count documentation packages
ls /usr/share/doc/ | wc -l

# Find specific package docs
ls /usr/share/doc/ | grep package-name

# Explore package documentation
ls /usr/share/doc/package-name*/

# Read documentation file
cat /usr/share/doc/package-name*/README

# Find example directories
find /usr/share/doc/ -type d -name "examples"

# List examples for specific package
ls /usr/share/doc/package-name*/examples/

Compressed File Commands

# View compressed file
zcat file.gz

# Page through compressed file
zless file.gz

# Search compressed file
zgrep pattern file.gz

# Search case-insensitive
zgrep -i pattern file.gz

# Count lines in compressed file
zcat file.gz | wc -l

# Show first 20 lines of compressed file
zcat file.gz | head -20

# Compare compressed files
zdiff file1.gz file2.gz

tldr Commands

# Install tldr (npm method)
sudo npm install -g tldr

# Install tldr (pip method)
sudo pip3 install tldr

# Get examples for command
tldr command-name

# Update tldr database
tldr --update

# List all available pages
tldr --list

# Search for command
tldr --list | grep keyword

# Show version
tldr --version

Combined Workflows

# Find and view compressed changelogs
find /usr/share/doc/ -name "CHANGE*.gz" | head -5 | xargs zless

# Search all READMEs for keyword
find /usr/share/doc/ -name "README*" -exec grep -l "keyword" {} \;

# Count total documentation files
find /usr/share/doc/ -type f | wc -l

# Find largest documentation files
find /usr/share/doc/ -type f -exec ls -lh {} \; | sort -k5 -hr | head -10

🎯 Key Takeaways

Let's summarize what you've mastered:

About /usr/share/doc:

  • Package-specific documentation directory
  • Contains READMEs, examples, changelogs, licenses
  • Each package gets its own subdirectory
  • Often includes working configuration examples
  • Many files are gzip-compressed

About z Tools:*

  • zcat - view compressed files
  • zless - page through compressed files
  • zgrep - search compressed files
  • All work like their non-z counterparts
  • No need to decompress files manually

About tldr:

  • Community-driven simplified documentation
  • Focuses on practical examples
  • Faster than man pages for common tasks
  • Install with npm or pip
  • NOT available during LFCS exam (but great for learning)

Documentation Strategy:

  1. tldr → Quick examples (practice only)
  2. --help → Brief option list
  3. /usr/share/doc → Configuration examples
  4. man pages → Complete reference (exam)
  5. info pages → Comprehensive tutorials

For LFCS Success:

  • Practice with all methods
  • Know where to find examples
  • Master z* tools for compressed docs
  • Create your own documentation library
  • Use man + /usr/share/doc during exam

🎉 Congratulations! You now have a complete documentation toolkit. You can find answers to ANY Linux question using these methods. This is a superpower for system administration and LFCS exam success!

🚀 What's Next?

In Part 15, we'll move on to a completely new topic: Understanding Network Interfaces with the ip Command. You'll learn:

  • Network interface basics (what is eth0, lo, etc.)
  • Using ip addr to view IP addresses
  • Using ip link to manage interfaces
  • Understanding interface states (UP, DOWN)
  • Temporary vs permanent network configuration
  • And much more!

Recommended practice before next post:

  • Work through all 20 practice labs above
  • Install tldr and try it on 10 different commands
  • Explore /usr/share/doc for packages you use daily
  • Create your personal documentation library
  • Practice combining methods (tldr → man → examples)

Continue your LFCS journey:


💡

📖 Keep Learning: You've now completed the entire Documentation Systems section of LFCS Phase 1! You've mastered man pages, info pages, --help, /usr/share/doc, and tldr. These skills will serve you throughout your entire Linux career. Next, we tackle networking! 🚀

Thank you for reading!

Published on November 18, 2025

Owais

Written by Owais

I'm an AIOps Engineer with a passion for AI, Operating Systems, Cloud, and Security—sharing insights that matter in today's tech world.

I completed the UK's Eduqual Level 6 Diploma in AIOps from Al Nafi International College, a globally recognized program that's changing careers worldwide. This diploma is:

  • ✅ Available online in 17+ languages
  • ✅ Includes free student visa guidance for Master's programs in Computer Science fields across the UK, USA, Canada, and more
  • ✅ Comes with job placement support and a 90-day success plan once you land a role
  • ✅ Offers a 1-year internship experience letter while you study—all with no hidden costs

It's not just a diploma—it's a career accelerator.

👉 Start your journey today with a 7-day free trial

Related Articles

Continue exploring with these handpicked articles that complement what you just read

More Reading

One more article you might find interesting