GDU is a command line tool that helps you find the disk usage of a folder or drive

Ashwin
Jun 2, 2021
Updated • Jun 15, 2021
Windows software
|
15

When my computer is running low on storage space, I use a program like TreeSize Free (Martin prefers WizTree) to check what's taking up the most amount of space, and move the content to my external drives. Such applications tend to be heavy on resources, and have a lot of options, some of which you may never use.

GDU is a command line tool that helps you find the disk usage of a folder or drive

GDU is a terminal based disk usage analysis tool that is lightweight and easy to use.

The program is portable, extract it to a folder after the download to get started. Since it does not have an interface, you will need to open a Command Prompt window and run GDU from it.

GDU example usage

Let's scan a drive, for this we need to enter GDU <DRIVE NAME>. For example, if we want to scan the C drive, we'll use GDU C:. The program will scan the drive and display the results in just a couple of seconds. GDU has a colorized command window, which makes it easy to distinguish folders from files. There is a monochrome mode that you can activate using GDU -c. E.g. GDU -c C:\.

GDU monochrome mode

The bar at the bottom of the screen tells you the total disk usage, and the file count. The command to scan a folder is similar to the one we used above, type GDU <FOLDER PATH>. Replace the folder path with the actual path like GDU C:\Users\Ashwin\Documents\. The program will list all directories in the folder, with their file size. The number at the top of the list indicates the total disk usage of the current folder. You can switch between actual usage (size on disk) and apparent usage size, with the a key.

Use the up and down arrow keys to navigate the list. Hit the Enter key to open the selected folder. This way you can find the disk usage of sub-folders individually. So, in a way GDU is sort of a file manager. To go back to the previous folder, tap the h key.

You may sort the directory by name with the n key, or by size with s. Tap the keys twice to switch between ascending and descending order. Did you notice that I have used lowercase for the key's names? That's because the shortcuts are case-sensitive. e.g. C will sort the items by file count, but c toggles the file count information.

GDU can open text files, to do so, select the document and press v. Use the Escape key to exit the file view mode.

Pressing the d key will delete the selected file or folder, the program warns you about this and asks for your confirmation before deleting the content. I advise paying attention to this option, else you could lose important data. When you're done with GDU, press the q key to exit the program.

GDU export file list to text document

You can export the data to a file, like a text document. The command for this is GDU > list.txt C:\. Replace "List" with a file name of your choice, and GDU will save the list of files and folders to a text document in its folder. Type ? to view the help file to view more commands.

GDU help file

GDU is an open source utility written in GO. It supports Windows, and Linux. The program's best feature is its speed, thanks to the fact it doesn't have an interface, switching to folders is an instantaneous process.

GDU

For Windows

Summary
software image
Author Rating
1star1star1star1stargray
4 based on 1 votes
Software Name
GDU
Operating System
Windows, Linux
Software Category
System
Price
Free
Landing Page
Advertisement

Tutorials & Tips


Previous Post: «
Next Post: «

Comments

  1. Binjamin Man said on June 5, 2021 at 2:03 am
    Reply

    My favorite third party tool is Directory Report
    It looks just like the MS-Explorer but always shows the folder size.
    Much faster than WinDirStat

  2. Tom said on June 3, 2021 at 9:05 pm
    Reply

    Interesting. I’ve always use rclone to manage my storage on each cloud service.

  3. owl said on June 3, 2021 at 10:25 am
    Reply

    My favorite is “WizTree”.
    It has an excellent GUI, displays results instantly, and has a lot of features that make it very useful.
    “WizFile” by the same developer is equally useful.
    https://antibody-software.com/wizfile/?ref=WizFile

  4. afds said on June 3, 2021 at 9:34 am
    Reply

    Total Commander – Alt + Shift + Enter.

  5. Anonymous said on June 3, 2021 at 2:18 am
    Reply

    Really cool app for admins.

  6. LaurentG said on June 2, 2021 at 5:18 pm
    Reply

    PPS : I just did the test : WizTree takes also into account ADS. The only requirement being (like for HardLinks) to analyse a full drive, and not directly a folder.

  7. LaurentG said on June 2, 2021 at 5:00 pm
    Reply

    PS : I just saw that TreeSize is also able to manage Hard Links (and also alternate data stream).
    But this is available only in the full (ie. paying…) versions.
    While it’s available for free in WizTree (not sure for ADS, I don’t think so to be honest. But ADS are very rarely used to host space consuming data, even if they can)

  8. LaurentG said on June 2, 2021 at 4:07 pm
    Reply

    At least on Windows, among the three tools mentioned here (TreeSize, WizTree and GDU) only ONE provides accurate view of disk usage…. and it’s WizTree.

    Why this difference : Because Wiztree (and only Wiztree) manages “hard links”, ie. files defined several times in the structure, but sharing the same data, present only once on the disk.
    This is in particular widely used by Windows files, a lot of them being defined once in C:\Windows\system32\… and once C:\Windows\winsxs\…. (non limitative example. A lot of other hard links exist).
    The only limitation of WizTree is that when such hard link exist, it has to “grant” the disk usage to one of the “copies” (and count others as 0), and it is not “manageable” to define which one is privilegied :
    1) to be effective, WizTree has to be launched as admin, and on the drive itself (not on a directory a/o sub-directory)
    2) the first instance of a file WizTree finds in the $MFT file gets the “allocated” space. Any subsequent files that are hard linked to that original file get flagged as zero allocated space.

    As a resut, on the same environment,
    – GDU says that my C:\Windows uses 29.2 Gb (which is WRONG)
    – TreeSize free says that C:\Windows is 28.8 Gb, but “only” 23.1 Gb “allocated”
    – WizTree say that C:\Windows is 28.8 Gb, but “only” 19.0 Gb “allocated”

    28.8 Gb is actually the sum of all files size
    23.1 Gb is actually the size of all ‘allocated’ files size (lower because some files are stored compressed, and then less space than their nominal size is allocated on the disk)
    19.0 Gb is the same, but counting only once “hard linked” doubloons, triploons, etc…

    And 19.0 Gb is the disk space actually used by C:\Windows.

    As a result, for me GDU is clearly wrong (I don’t where its value come from), and TreeSize free is partially wrong.
    Only WizTree provides the accurate disk space used.

    Knowing that (in more….) WizTree is (from far !) the fastest tool in its analysis phase, there is no photo : Since I discovered it, I gave up all the tools I used before (like WinDirStat) and use only WzTree now.

    I have no link, nor no interest, with team developping Wiztree. My choice is “free” and honest !

  9. Pet said on June 2, 2021 at 3:36 pm
    Reply

    We are supposed to evolve. Why the hell someone will need this list crap instead of the already visual one that gives the same exact info?
    Linux lovers are spreading their pre WW2 era ideas in our modern OSes.
    Now you can exterminate your mice too. The fat – unshaved nerds wants us to use keyboards only. Then our PCs will become larger and wont fit in our rooms. Then the WW1 will happen, and then we may see the French Revolution again.

    Viva la Nerds.

    1. Foo Bar said on August 10, 2021 at 11:40 pm
      Reply

      automation is the future. 99% of windows gui tools cannot be automated, but depend on manual processes of clicking through non-standardized menus. 99% of cli tools can be automated and for the most part follow a standard way of doing things. Who’s backwards now?

    2. Martin P. said on June 4, 2021 at 2:51 pm
      Reply

      @Pet

      Wow… Expert advice yeah…

      Something we can do without.

    3. pwned said on June 3, 2021 at 3:24 pm
      Reply

      @Pet

      When you learn to code and develop your own tools for whatever purpose you want, then let us know.

      The only evolution I see in this world you envisage is the world where only you have evolved into the Homos Stolidus, who will go procreate with himself.

    4. thebrowser said on June 3, 2021 at 11:46 am
      Reply

      “We are supposed to evolve.”

      Proceeds to talk about events that happened over 100 years ago. This guys just won the internet for the day :D

      Also, great tool Ashwin!

    5. Anonymous said on June 2, 2021 at 9:38 pm
      Reply

      “I dOnT uNdErStAnD tHe PuRpOsE oF tHiS sO I aM gOnNa ThRoW a TaNtRuM”.

      If you don’t have any use case for command line tools, then keep using what works for you. Problem solved.

      Nobody forced you to do anything. Nobody owes you anything.

  10. Anonymous said on June 2, 2021 at 3:24 pm
    Reply

    Good-looking tool.

    There is also the great dust:

    https://github.com/bootandy/dust

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

We love comments and welcome thoughtful and civilized discussion. Rudeness and personal attacks will not be tolerated. Please stay on-topic.
Please note that your comment may not appear immediately after you post it.