1.13 Disk and System Information
df (disk free) — Report File System Disk Space Usage Utility
Format:
df [options] [file_or_directory]
Common Options:
| Option | Architectural Meaning / Function |
|---|---|
| -a | Include pseudo, duplicate, and inaccessible file systems. |
| -h | Print sizes in human-readable format (e.g., 1K, 234M, 2G) using power-of-1024 units (Recommended). |
| -H | Print sizes in human-readable format using power-of-1000 units. |
| -k | Block sizes default to 1024 bytes (1 KB). |
| -m | Block sizes default to 1,048,576 bytes (1 MB). |
| -B SIZE | Scale sizes by SIZE before printing them. |
| -i | List inode usage information instead of block usage. |
| -T | Print the type of each file system. |
| -x TYPE | Limit listing to file systems not of type TYPE. |
| -l | Limit 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:
| Option | Architectural Meaning / Function |
|---|---|
| -h | Print sizes in human-readable format using power-of-1024 units (Recommended). |
| -H | Print sizes in human-readable format using power-of-1000 units. |
| -k | Block sizes default to 1024 bytes (1 KB). |
| -m | Block sizes default to 1,048,576 bytes (1 MB). |
| -B SIZE | Scale sizes by SIZE block constants. |
| -s | Display only a total for each argument. |
| --max-depth=N | Print the total for a directory (or file, with -a) only if it is N or fewer levels below the command line argument. |
| --exclude=PATTERN | Exclude files or directories that match the specified PATTERN. |
| --apparent-size | Print apparent sizes rather than disk usage (du tracks actual block consumption by default). |
| -a | Write 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:
| Option | Architectural Meaning / Function |
|---|---|
| -h | Display all memory fields automatically scaled to shortest 3-digit unit. |
| -b | Display the amount of memory in bytes. |
| -k | Display the amount of memory in kilobytes (default). |
| -m | Display the amount of memory in megabytes. |
| -g | Display the amount of memory in gigabytes. |
| -s N | Continuously display the output delayed by N seconds. |
| -t | Display 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:
| Option | Architectural Meaning / Function |
|---|---|
| -a | Print all system information in a sequence. |
| -s | Print the kernel name. |
| -n | Print the network node hostname. |
| -r | Print the kernel release version. |
| -v | Print the kernel compilation version. |
| -m | Print the machine hardware architecture name. |
| -p | Print the processor type (architecture-dependent). |
| -i | Print the hardware platform identifier. |
| -o | Print 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