+3 votes
500 views
How to install and use Dutree to analyze disk usage on Linux

in Linux / Unix by (551k points)
reopened | 500 views

1 Answer

+4 votes
Best answer

1. How to install Dutree on Linux
2. How to use Dutree in Linux
3. How to display directories in depth with Dutree on Linux
4. How to exclude files or directories in the search with Dutree on Linux
5. How to add small files with Dutree on Linux
6. How to exclude hidden files with Dutree on Linux

There are a number of system components, both hardware and software, which have been designed to optimize the total use of system resources and thus be more productive in all aspects and one of these elements is the hard disk ..

We currently have mechanical hard drives (HDD) and solid state hard drives (SDD) which offer us various features both in terms of capacity and performance, but the purpose of all is the same: provide a storage space to house the operating system, applications and programs and files that we create as daily users.

Little by little we occupy the space of the hard disk and although this is 1 or 2 TB sooner or later we can be faced with a space limitation which affects factors such as:

  • Process of access to information, reading and writing, slow
  • Unexpected system reboots
  • Disk sector failures
  • Inability to install new applications
  • Failures to save new files
A good practice that as users we must take, is to constantly check the state of the disk and if we are Linux users one of the most useful tools for this is Dutree which analyze TechnoWikis in detail.
What is duty
Dutree is a command line tool which has been developed to effectively find out which files or directories are taking up space on the hard disk. Dutree is written in the Rust programming language and displays a summary of the directories and / or files that take up more space allowing us to take control over them and free up space on the hard drive.

One of the advantages of Dutree is that, instead of showing only the root of the files with their respective size, or the details of each file, it will only display the routes that occupy more space focusing only on this aspect.

Dutree is developed by two components and hence its name:

  • durep (disk usage reporter - generates disk usage reports)
  • tree (list the contents of the directory in tree format)
Dutree features
Some of the features we find of Dutree are:
  • Supports aggregation of small files
  • Supports the exclusion of files or directories
  • Output of colored results, based on the LS_COLORS environment variable
  • It allows to compare different directories

1. How to install Dutree on Linux

Step 1

To perform the process of installing Dutree on Linux distributions, it will be necessary to have the Rust programming language in the system, for this we will execute the following:
 sudo curl https://sh.rustup.rs -sSf | sh 
image
Step 2

Once the Rust language has been installed on the system, it will be possible to execute the following command to install strong> dutree on Linux distributions as follows:
 charge install --git https://github.com/nachoparker/dutree.git 
image
Step 3

After installing Dutree in the system, we can use the colors of the environment according to the LS_COLORS variable, which has the same colors as the ls --color command which the distribution has configured:
 ls –color 
image

2. How to use Dutree in Linux

Step 1

To deploy a file system tree, just run Dutree without any arguments like this:
 dutree 
image
Step 2

The size of this result varies according to the directory in which we are located. If we want to display the actual use of the hard disk instead of the file size, it will be necessary to use the -u parameter: image

3. How to display directories in depth with Dutree on Linux


When using Dutree it will be possible to display directories to a specific depth which is by default 1, and this is achieved using the -d indicator.

For example, with the following command we will show the directories up to a depth of 4, below the current working directory in the system:

 dutree -d 4 
image

4. How to exclude files or directories in the search with Dutree on Linux

Step 1

If we want to exclude a specific directory or folder from the Dutree analysis result, we will use the following syntax:
 dutree -x (File or directory name) 
For example, we will exclude the tools directory:
 dutree -x tools 
image
Step 2

With Dutree it will be possible to obtain a quick local overview by omitting directories, making use of the -f option like this:
 dutree -f 
image
Step 3

To generate a complete summary we will use the -s parameter:
 dutree -s 
image

5. How to add small files with Dutree on Linux


With the use of the Dutree tool it will be possible to add files smaller than those defined by the default value which is 1 MB, for this we will add the -a parameter:
 dutree -a 
As a result we will see that all files smaller than the default size will have the aggregated legend: image

6. How to exclude hidden files with Dutree on Linux


Many hidden system files may take time to scan, but also remember that these files are from the system and their accidental deletion or may not have a negative impact on the stability of the overall system.
Step 1

To exclude these files from the Dutree analysis we will run the following line:
 dutree -H 
image
Step 2

If we want the results to be printed in bytes we will execute the following:
 dutree -b 
image
Step 3

To deactivate the colors, and only show ASCII characters, we will use the -A parameter: image
Step 4

Finally, if we want to see Dutree's help we will execute the following:
 dutree -h 
image

Dutree is a simple utility that will give us the option to control and manage in a simple but complete way the hard drives in Linux..


by (3.5m points)
edited

Related questions

+4 votes
1 answer
asked Oct 14, 2019 in Linux / Unix by backtothefuture (551k points) | 251 views
+4 votes
1 answer
asked Oct 28, 2019 in Linux / Unix by backtothefuture (551k points) | 232 views
+5 votes
1 answer
asked Apr 30, 2020 in Linux / Unix by backtothefuture (551k points) | 294 views
+3 votes
1 answer
+4 votes
1 answer
asked Nov 11, 2019 in Linux / Unix by backtothefuture (551k points) | 365 views
Sponsored articles cost $40 per post. You can contact us via Feedback
10,634 questions
10,766 answers
510 comments
3 users