cmd Viewing disk usage
Viewing disk usage and available space in the Windows Command Prompt (cmd) is essential for managing storage, optimizing performance, and troubleshooting issues. Several commands can help you check the disk space, usage, and other related information. Below, I’ll explain the key commands used for viewing disk usage and space, along with examples and expected outputs.
1. Using the dir
Command
The dir
command lists the contents of a directory, and it also provides information about the total number of files, directories, and the total size of files within that directory.
Basic Syntax:
Example:
To view the contents and disk usage of the current directory, simply enter:
Output:
Output Explanation:
- The output displays the directories and files within the current directory, along with the total bytes free on the disk.
2. Using the wmic
Command
The wmic
(Windows Management Instrumentation Command-line) tool can provide detailed information about disk drives, including available space and total size.
Basic Syntax:
Example:
To view the total size and free space for all disk drives, enter:
Output:
Output Explanation:
- Caption: The drive letter (e.g., C:, D:).
- FreeSpace: The available space in bytes.
- Size: The total size of the disk in bytes.
3. Using the fsutil
Command
The fsutil
command can provide information about free and total disk space, among other filesystem-related tasks.
Basic Syntax:
Example:
To view the disk space for drive C, enter:
Output:
Output Explanation:
- Total # of free bytes: The amount of free space available on the drive.
- Total # of bytes: The total capacity of the drive.
4. Using the diskpart
Command
The diskpart
command is a more advanced tool for disk management. You can use it to view detailed information about all connected drives.
Basic Syntax:
Once in the DiskPart command line, use:
Example:
To start DiskPart and list all volumes, enter:
Then, in the DiskPart prompt:
Output:
Output Explanation:
- Volume ###: The volume number.
- Ltr: The drive letter assigned to the volume.
- Label: The label of the volume (if any).
- Fs: The file system used (e.g., NTFS).
- Type: Indicates whether the volume is a partition or a removable drive.
- Size: The total size of the volume.
- Status: The health status of the volume.
Summary
Viewing disk usage and available space in the Windows Command Prompt can be accomplished using several commands such as dir
for basic directory and file size information, wmic
for detailed drive statistics, fsutil
for specific disk space queries, and diskpart
for advanced disk management. Understanding how to view and manage disk space is crucial for maintaining system performance and optimizing storage usage.