Rocky Linux Core Commands: Page 5

This page introduces commands for checking disk space, memory usage, and monitoring running processes.


21. df - Report File System Disk Space Usage

Purpose: The df command (disk free) displays the amount of available and used disk space on file systems.

Syntax: df [OPTIONS] [FILE...]

Key Options:

Examples:

df -h
df -hT /dev/sda1

22. du - Estimate File Space Usage

Purpose: The du command (disk usage) estimates file space usage. It's useful for finding out how much space a specific file or directory (and its contents) is consuming.

Syntax: du [OPTIONS] [FILE...]

Key Options:

Examples:

du -h my_folder/
du -sh /var/log/
du -ch images/ videos/

23. free - Display Amount of Free and Used Memory

Purpose: The free command displays the total amount of free and used physical and swap memory in the system, as well as the buffers and caches used by the kernel.

Syntax: free [OPTIONS]

Key Options:

Examples:

free -h
free -ht

24. top - Display Linux Processes

Purpose: The top command provides a dynamic, real-time view of running processes. It shows CPU usage, memory usage, swap space, and information about individual processes.

Syntax: top

Key Interactions (within top):

Example:

top

This command opens an interactive, updating display.


25. ps - Report a Snapshot of Current Processes

Purpose: The ps command (process status) displays information about currently running processes. Unlike top, it provides a static snapshot at the moment the command is run.

Syntax: ps [OPTIONS]

Key Options:

Examples:

ps aux
ps -ef | grep firefox