> For the complete documentation index, see [llms.txt](https://chunhthanhde.gitbook.io/google-learning-programs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://chunhthanhde.gitbook.io/google-learning-programs/google-it-support-professional-certificate/course-3-operating-systems-and-becoming-a-power-user/module-4-filesystems/1.filesystem-types/11.window-linux-disk-usage.md).

# Monitoring and Managing Disk Usage in Windows 🖥️

### **Checking Disk Usage**

1. **Graphical User Interface**:
   * **Disk Management Console**:
     * **Access**: Open the Computer Management utility and navigate to the Disk Management console.
     * **View Usage**: Right-click on the partition of interest and select **Properties** to see the used and free space on the drive. 📊
2. **Command Line Utility**:
   * **Disk Usage (DU) Tool**:
     * **Function**: Prints out disk usage details, including the number of files.
     * **Usage**: Useful for scripting and text-based outputs.
     * **Access**: The DU tool is part of Sysinternals and can be found in supplemental readings. 🖥️📜

### **Disk Cleanup**

* **Clean Manager**:
  * **Access**: Click the **Disk Cleanup** button in the Disk Management console.
  * **Function**: Deletes temporary files, compresses old files, cleans up logs, and empties the Recycle Bin to free up disk space. 🧹

### **Disk Defragmentation**

* **Purpose**:
  * **Traditional Hard Drives**: Reorganizes files into contiguous locations to reduce the distance the read/write head must travel, improving access speed.
  * **Solid-State Drives (SSDs)**: Not physically needed, but Windows uses a process called **Trim** to reclaim unused space.
* **Scheduled Task**:
  * **Automatic**: Windows performs defragmentation periodically without user intervention.
* **Manual Defragmentation**:
  * **Tool**: Access the Disk Defragmenter by typing `disk defragmenter` in the search bar.
  * **Function**: Analyze and manually run defragmentation for selected disks. 📅🔄

Understanding and managing disk usage is essential for maintaining optimal performance and storage efficiency on your Windows machine. 🌟

***

## Monitoring Disk Usage in Linux 🐧💽

### **Checking Disk Usage**

1. **Disk Usage (du) Command**:
   * **Purpose**: Displays the disk usage of specific directories.
   * **Usage**:
     * `du -h`: Shows disk usage in a human-readable format (e.g., KB, MB, GB).
     * **Default Behavior**: If no directory is specified, it defaults to the current directory.
   * **When to Use**: To determine how much disk space is being used by files within a particular directory. 📂
2. **Disk Free (df) Command**:
   * **Purpose**: Provides information on free space across the entire file system.
   * **Usage**:
     * `df -h`: Displays available disk space in a human-readable format.
   * **When to Use**: To check the total free space available on your machine. 📊

### **File System Fragmentation**

* **Fragmentation in Linux**:
  * Linux file systems generally handle fragmentation better than Windows file systems.
  * **Defragmentation**: Not typically required for Linux as it manages disk space efficiently to minimize fragmentation. 🔄

### **Managing Disk Space**

* **Investigation and Cleanup**:
  * If running low on disk space, use `du` and `df` commands to investigate space usage.
  * **Caution**: Be careful when deleting files to avoid accidental loss of important data.

Understanding and managing disk usage is crucial for maintaining system performance and avoiding storage issues. 🌟
