Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

1.13 Disk and System Information

df (disk free) — Report File System Disk Space Usage Utility

Format:

df [options] [file_or_directory]

Common Options:

OptionArchitectural Meaning / Function
-aInclude pseudo, duplicate, and inaccessible file systems.
-hPrint sizes in human-readable format (e.g., 1K, 234M, 2G) using power-of-1024 units (Recommended).
-HPrint sizes in human-readable format using power-of-1000 units.
-kBlock sizes default to 1024 bytes (1 KB).
-mBlock sizes default to 1,048,576 bytes (1 MB).
-B SIZEScale sizes by SIZE before printing them.
-iList inode usage information instead of block usage.
-TPrint the type of each file system.
-x TYPELimit listing to file systems not of type TYPE.
-lLimit listing to local file systems.

Examples:

$ df -m

$ df -B 1G

$ df -h /var/log # View the storage partition hosting the /var/log directory

$ df -t ext4 # Restrict visibility strictly to ext4 file systems

du (disk usage) — Estimate File Space Usage Utility

Format:

du [options] [file_or_directory]

Common Options:

OptionArchitectural Meaning / Function
-hPrint sizes in human-readable format using power-of-1024 units (Recommended).
-HPrint sizes in human-readable format using power-of-1000 units.
-kBlock sizes default to 1024 bytes (1 KB).
-mBlock sizes default to 1,048,576 bytes (1 MB).
-B SIZEScale sizes by SIZE block constants.
-sDisplay only a total for each argument.
--max-depth=NPrint the total for a directory (or file, with -a) only if it is N or fewer levels below the command line argument.
--exclude=PATTERNExclude files or directories that match the specified PATTERN.
--apparent-sizePrint apparent sizes rather than disk usage (du tracks actual block consumption by default).
-aWrite counts for all files, not just directories.

Examples:

$ du -m /home

$ du -B 1G

$ du -h --max-depth=1

$ du -h --max-depth=2 /var

$ du -h --exclude=*.log # Omit files featuring the .log extension suffix

$ du -h --exclude=/home/test # Exclude the explicit directory tree at /home/test

$ du -h --apparent-size # Calculate logical file dimensions instead of block allocations

$ du -ah # Process all entries recursively, including regular files

$ du -sh * | sort -hr | head -20 # Sort and display the top 20 largest irectory targets

free — Display Amount of Free and Used Memory in the System

Format:

free [options]

Common Options:

OptionArchitectural Meaning / Function
-hDisplay all memory fields automatically scaled to shortest 3-digit unit.
-bDisplay the amount of memory in bytes.
-kDisplay the amount of memory in kilobytes (default).
-mDisplay the amount of memory in megabytes.
-gDisplay the amount of memory in gigabytes.
-s NContinuously display the output delayed by N seconds.
-tDisplay a line showing column totals.

Examples:

$ free -h # Display all physical memory, swap, and buffer metrics in
human-readable format

$ free -h -s 2 # Refresh metrics continuously onto stdout every 2 seconds

uname (unix name) — Print System Information

Format:

uname [options]

Common Options:

OptionArchitectural Meaning / Function
-aPrint all system information in a sequence.
-sPrint the kernel name.
-nPrint the network node hostname.
-rPrint the kernel release version.
-vPrint the kernel compilation version.
-mPrint the machine hardware architecture name.
-pPrint the processor type (architecture-dependent).
-iPrint the hardware platform identifier.
-oPrint the operating system name.

Examples:

$ uname -r # Display the release version string of the running kernel

$ uname -v # Display the compilation and build timestamps of the kernel
Copyright © 2026 Guangzhou eSmart Information Technology Co., Ltd. All Rights Reserved.
All content in this book is copyrighted by the author. For personal learning and exchange only. Commercial use without authorization is strictly prohibited. Email:

✉ 3348194517@qq.com | hai616878@gmail.com