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.
on June 26, 2010
In Windows , we can find free space of a disk drive using fsutil command. This command’s syntax is shown below.
fsutil volume diskfree driveletter
drive letter can be any local drive.
Ex:
C:\>fsutil volume diskfree e: Total # of free bytes : 45569585152 Total # of bytes : 52427898880 Total # of avail free bytes : 45569585152
Note that this command should be run from elevated command prompt. See How to open elevated command prompt
The above fsutil command works on XP, Vista, Windows 7, Server 2003 and Server 2008.
Low storage space on a computer can be daunting. It can either be fixed by moving your data, deleting it, or adding a new hard drive. It is therefore important to know which files consume the most storage.
This can be done using File Explorer, Storage Sense, and other mechanisms. However, in certain scenarios, getting this information for each partition or folder is simpler using the Windows command line.
On Windows 11, you can use the “DiskUsage” command to view the storage details for different partition volumes, folders, and subfolders. This command also allows you to use switches and filter the information that you want to see. For example, you can use the /minFileSize
switch to set a minimum file size filter or the /u
switch to view a fixed number of items.
The DiskUsage command has been introduced after referencing from the DU
command on Linux distros which serves the same storage-space-info purpose.
Note: After having tested out the DiskUsage command-line tool, we found that it is not included in Windows 10. Although it was anticipated to be introduced a few years ago, it now no longer exists and is only available on Windows 11 at the time of writing this post.
Table of Contents
On this page
View disk space usage from command line
With the DiskUsage command, you only need to enter the prompt and the complete path of the drive or folder that you want to get the information for. Here are the steps to use the DiskUsage command to obtain disk utilization information using Command Prompt:
-
Press the Windows Key + R to open the Run Command box.
-
Type in “cmd” and press CTRL + Shift + Enter to run Command Prompt with administrative privileges.
-
In the Command Prompt, use the following command while replacing [PathToFolder] with the complete path to the drive or folder that you want to view information on:
DiskUsage [PathToFolder]
View disk usage from Command Prompt
This will now show the complete details for the items inside the specified directory, including the subdirectories. As you can see in the image above, you also get information on the number of items inside each subdirectory and its total size in bytes.
If you want the file and directory size in KBs, KBs, and GBs, then you must use the /h
switch at the end of the command, as in this example:
DiskUsage [PathToFolder] /h
View disk usage with minimum file size
As mentioned earlier in this post, you can use certain switches to set filters and view items greater than a specified file size within a drive or a directory. For this purpose, you can use the /minFileSize
switch with the DiskUsage
command.
Here’s how to set the filters to view files greater than the specified file size:
Note: The specified file size is in bytes. Therefore, you may need to convert the file size from GBs, MBs, and KBs, to bytes. You can use the following conversion numbers:
- 1 GB = 1073741824 bytes
- 1 MB = 1048576 bytes
- 1 KB = 1024 bytes
-
Press the Windows Key + R to open the Run Command box.
-
Type in “cmd” and press CTRL + Shift + Enter to run Command Prompt with administrative privileges.
-
Use the following command to view disk usage details for all files greater than a specific size while replacing [PathToFolder] with the complete path to the drive or folder that you want to view information on, and [FileSize] with the size of the files that you want to see (in bytes):
DiskUsage /minFileSize=[FileSize] [PathToFolder] /h
View disk usage greater than specific file size using Command Prompt
In the image above, we viewed all items inside the “D:\Itechtics” directory that were greater than 5 GB. As you can see from the results, only one subdirectory with the name “ISOs” was listed that occupied 73.4 GBs on the disk.
View disk usage for specific number of items
Using the same concept as above, you can also set a filter to the command that will show you a fixed number of items only.
Instead of vetting through hundreds and thousands of items within a directory, you can set the DiskUsage
command to show you only the top 5 or top 10 (whichever number you choose) files greater than a specific file size. This can be achieved with the /u
switch.
Simply use the following command syntax while replacing the necessary variables within the square brackets []:
DiskUsage /minFileSize=[FileSize] [PathToFolder] /h /u=[ItemsToDisplay]
As you can observe from the image above, only 10 items have been displayed. These are the top 10 items in descending order within the “D:\Itechtics” directory that are greater than 1 MB.
View disk usage by file name
On top of the filters that we have already discussed, you can also include the file name that you want to filter. By applying the /n
filter, you can include a partial name of the file(s) that you want to display. All files and subdirectories which include that name will be displayed along with their size details.
Here is the command syntax that you can use to view an item within a directory, having a file size greater than that specified, and includes a name, while replacing the necessary variables:
DiskUsage /minFileSize=[FileSize] [PathToFolder] /h /n=[Name]
DiskUsage in Windows 11
As mentioned at the beginning of this post, the DiskUsage
command is only available for Windows 11 at the moment.
Using this command, you can view the details for stored items within a drive or directory directly in your command line. This saves you the hassle of going to individual items and then using the Graphical User Interface (GUI), like the Properties window, to view the disk usage details.
This article discusses multiple command-line switches that you can use to set filters, making your searches even more human-readable. To learn more about the DiskUsage
command and its switches, type in “DiskUsage /?
” into the Command Prompt and learn about the additional switches that you can use.
How to Check Total Hard Disk Space in Windows 10 CMD
Want to quickly check your total hard disk space in Windows 10 using the Command Prompt (CMD)? Just open CMD, type a specific command, and voila! You can get all the details you need. It’s super easy, even if you’re not a tech wizard.
In this step-by-step guide, we’ll show you how to use the Command Prompt to check the total hard disk space on your Windows 10 computer. By the end, you’ll be able to see how much storage you have and how much is being used.
Step 1: Open Command Prompt
First, open the Command Prompt.
To do this, press the Windows key, type «cmd,» and hit Enter. The Command Prompt window will open.
Step 2: Run Command
Next, type the command wmic diskdrive get size
and press Enter.
This command tells CMD to get the size of all disk drives connected to your computer.
Step 3: Interpret Results
After running the command, the Command Prompt will display the sizes of all connected drives in bytes.
The numbers might seem huge because they are in bytes. Divide by 1,073,741,824 to convert to gigabytes.
Step 4: Close Command Prompt
Once you’ve got the information you need, you can close the Command Prompt by typing «exit» and hitting Enter.
This will close the CMD window, and you’re done!
After completing these steps, you’ll see the total size of your hard drives in bytes. Converting them to gigabytes will give you a clearer picture of your storage space.
Tips for Checking Total Hard Disk Space in Windows 10 CMD
- Use Other Commands: Commands like
wmic logicaldisk get size,freespace,caption
give more detailed info, including free space. - Run as Administrator: Sometimes, running CMD as an administrator can provide more detailed information.
- Double-Check in File Explorer: Always cross-verify with File Explorer to ensure the numbers match up.
- Stay Updated: Windows updates can sometimes change how certain commands work, so keep your system updated.
- Use Third-Party Tools: Software like WinDirStat can provide a more detailed breakdown of disk usage.
Frequently Asked Questions
How do I open the Command Prompt as an administrator?
Right-click the Start button, then select «Command Prompt (Admin)» or «Windows PowerShell (Admin).»
Can I check the hard disk space of external drives?
Yes, the command wmic diskdrive get size
will include information on external drives connected to your computer.
Is there a way to convert bytes to gigabytes directly in CMD?
Unfortunately, CMD does not have a direct conversion tool. You’ll need to do the math: divide the byte count by 1,073,741,824 to get gigabytes.
Will this work on older versions of Windows?
Yes, similar commands work on older versions like Windows 7 and 8, but the steps to open CMD may differ.
Can I use PowerShell instead of CMD?
Absolutely! PowerShell offers similar commands, and sometimes even more detailed options for checking disk space.
Summary
- Open Command Prompt.
- Run the command
wmic diskdrive get size
. - Interpret the results in bytes.
- Close Command Prompt.
Conclusion
Checking your total hard disk space in Windows 10 via CMD is a breeze once you know the steps. Just open CMD, run a simple command, and you’ll have your answer in no time. This method is not only quick but also reliable.
For those who prefer a graphical interface, File Explorer is always an option, but knowing how to use CMD can come in handy, especially if you’re troubleshooting or managing a server. If you’re curious about other ways to manage your disk space, you might explore third-party tools or even dive deeper into PowerShell commands for more advanced features.
So, why not give it a try? The next time you need to check your hard disk space, you’ll know exactly what to do. Plus, mastering these basic CMD commands can open up a whole new world of possibilities for managing your Windows 10 system.
Matt Jacobs has been working as an IT consultant for small businesses since receiving his Master’s degree in 2003. While he still does some consulting work, his primary focus now is on creating technology support content for SupportYourTech.com.
His work can be found on many websites and focuses on topics such as Microsoft Office, Apple devices, Android devices, Photoshop, and more.