Inspecting Disk Usage (Ncdu)
To determine the sizes of files and discover the largest files in a directory, one can use the Ncdu module.
Last updated
To determine the sizes of files and discover the largest files in a directory, one can use the Ncdu module.
Last updated
To get started with NCDU, load the module using the following command:
Once the module has been loaded, it can be used to easily show the size of all files within a directory:
To view options you can use with the ncdu
command, simply use the command ncdu --help
The line above uses Ncdu to rank all of the files within the my_directory
directory. Your window should change to show a loading screen (if the directory doesn't have a lot in it, you may not even see this screen):
Once Ncdu has finished loading, you will see a result like this:
The files will be ordered with the largest file at the top and the smallest file at the bottom. The bottom left corner shows the Total disk usage
(which in this case is 25.5 KiB). To quit out of this display, simply press q on your keyboard.
If there is a subdirectory within the directory you're inspecting, the files and directories within that subdirectory can be viewed by selecting the directory with the gray bar (using up and down arrow keys as needed) and then using the right arrow key.