
Note that we also use the tail command to avoid printing the size of the parent directory, which would be irrelevant in this case. In that case, we can pipe our output to the head command to only show the biggest directories. However, many times you may only be interested in the 10 biggest directories, or some number similar to that. Using the commands above, even small directories will be listed in the du command output. $ sudo du -h -max-depth=1 / | sort -h 2> /dev/null If you try to run du on your root directory to see storage space across the entire disk, keep in mind that you’ll need to execute that command with root privileges and you should redirect standard error to /dev/null since you’ll get a lot of “permission denied” spam in your output. Keep in mind that you can specify any directory with the command – you don’t have to actually be in the directory you’re checking. In these examples, we’ve been running du from our present working directory. Or, to limit the number of directories that are recursively traversed: $ du -h -max-depth=1 | sort -h If you’re using the -h option on du, make sure you also use it on sort. To sort these directories by size, making it easy to identify which ones are consuming the most space, we can pipe our du command to the sort utility. If you have a deep structure, we can use the -max-depth=N flag to tell du how many subdirectories deep it should traverse. This gives us a rather granular look at how much space each subdirectory is using. $ du -hĪs you can see, the “Debian-based” and “RHEL-based” directories have two and three subdirectories, respectively. Let’s see what happens if we have a deeper folder structure. The total of all these folders is 44 GB, as indicated in the last line. We can see that the AlmaLinux folder is using 11 GB, and the Debian folder is only using 349 MB. We’ll append the -h (human readable) option so it’s easier to see what kind of space these directories are consuming.
#LINUX LIST FILE DETAILS FULL#
In the following example, we run du on a directory full of Linux ISO files, but it’s only one directory deep.

Depending on how deep your folder structure goes, this could be a massive amount of directories, and your terminal will be spammed with a lot of output. When running du without any extra options, keep in mind that it will check the total disk usage of each subdirectory, individually. For checking disk usage by folder, the du command is particularly useful. The df and du command line utilities are the two best tools we have to measure disk consumption on Linux.

List directories by size via command line $ – requires given linux commands to be executed as a regular non-privileged user # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command Privileged access to your Linux system as root or via the sudo command.
#LINUX LIST FILE DETAILS SOFTWARE#
Requirements, Conventions or Software Version Used Listing the biggest directories on Linux Software Requirements and Linux Command Line Conventions Category
