Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install and use Dutree under Linux

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces "how to install and use Dutree under Linux" related knowledge, editor through the actual case to show you the operation process, the method of operation is simple and fast, practical, I hope that this "how to install and use Dutree under Linux" article can help you solve the problem.

Dutree is a free, open source, fast command-line tool for analyzing disk usage, written in the Rust programming language. It was developed by durep (disk usage reporter) and tree (list directory content, tree format) command line tools. Therefore, dutree reports disk usage in a tree format.

System environment

Centos7

Installation

You need to install the cargo package manager first

[root@localhost ~] # yum-y install cargo

Secondly, configure the warehouse address of cargo, because foreign sources are used by default, and the download speed is too slow:

Go to $HOME/.cargo to create a config configuration file:

[root@localhost ~] # cd $HOME/.cargo [root@localhost. Examples] # touch config

Copy the following to the config configuration file:

[source.crates-io] registry = "https://github.com/rust-lang/crates.io-index"# is replaced with a faster mirror source, which is used here by Shanghai Jiaotong University. Replace-with = 'sjtu'# Tsinghua University [source.tuna] registry = "https://mirrors.tuna.tsinghua.edu.cn/git/crates.io-index.git"# Shanghai Jiaotong University [source.sjtu] registry =" https://mirrors.sjtug.sjtu.edu.cn/git/crates.io-index"# rustcc Community [source.rustcc] registry = "git://crates.rustcc.cn/crates.io-index"

Start installing dutree:

[root@localhost ~] # cargo install dutree Updating `https://mirrors.sjtug.sjtu.edu.cn/git/crates.io-index` index Downloaded dutree v0.2.16 (registry `https://mirrors.sjtug.sjtu.edu.cn/git/crates.io-index`) Downloaded 1 crate (638.0 KB) in 0.37s Installing dutree v0.2.16 Downloaded signal-hook v0.1.16 (registry `https://mirrors.sjtug.sjtu.edu.cn/git/crates.io-index`) Downloaded terminal) _ size v0.1.13 (registry `https://mirrors.sjtug.sjtu.edu.cn/git/crates.io-index`) Downloaded thread_local v1.0.1 (registry `https://mirrors.sjtug.sjtu.edu.cn/git/crates.io-index`) Downloaded signal-hook-registry v1.2.2 (registry `https://mirrors.sjtug.sjtu.edu.cn/git/crates.io-index`) Downloaded unicode-width v0.1.8 (registry `https://mirrors.sjtug.sjtu.) Edu.cn/git/crates.io- index`) Downloaded memchr v2.3.4 (registry `https://mirrors.sjtug.sjtu.edu.cn/git/crates.io-index`) Downloaded regex-syntax v0.6.21 (registry `https://mirrors.sjtug.sjtu.edu.cn/git/crates.io-index`) Downloaded aho-corasick v0.7.14 (registry `https://mirrors.sjtug.sjtu.edu.cn/git/crates.io-index`) Downloaded regex v1.4.2 (registry `https: / / mirrors.sjtug.sjtu.edu.cn/git/crates.io- index`) Downloaded libc v0.2.80 (registry `https://mirrors.sjtug.sjtu.edu.cn/git/crates.io-index`) Downloaded lazy_static v1.4.0 (registry `https://mirrors.sjtug.sjtu.edu.cn/git/crates.io-index`) Downloaded getopts v0.2.21 (registry `https://mirrors.sjtug.sjtu.edu.cn/git/crates.io-index`) Downloaded unicode-segmentation v1) .6.0 (registry `https://mirrors.sjtug.sjtu.edu.cn/git/crates.io-index`) Downloaded 13 crates (1.4 MB) in 0.43s Compiling libc v0.2.80 Compiling memchr v2.3.4 Compiling lazy_static v1.4.0 Compiling unicode-width v0.1.8 Compiling regex-syntax v0.6.21 Compiling unicode-segmentation v1.6.0 Compiling thread_local v1.0.1 Compiling getopts v0.2.21 Compiling signal-hook-registry v1.2.2 Compiling terminal _ size v0.1.13 Compiling aho-corasick v0.7.14 Compiling signal-hook v0.1.16 Compiling regex v1.4.2 Compiling dutree v0.2.16 Finished release [optimized] target (s) in 1m 35s Installing / root/.cargo/bin/dutree Installed package `dutree v0.2.16` (executable `dutree`) warning: be sure to add `/ root/.cargo/ bin` to your PATH to be able to run the installed binaries

Seeing the last warning prompt above, you need to add the / root/.cargo/bin directory to the PATH environment variable:

[root@localhost ~] # echo "export PATH=$PATH:/root/.cargo/bin" > ~ / .bashrc [root@localhost ~] # source ~ / .bashrc

Now you can use dutree

Example

Directory depth

Use the-d option, plus numbers, to view an one-tier directory or a multi-tier directory. The following is to view the / root user's home directory, and check the first-tier directory:

[root@localhost ~] # dutree-D1. /

The following is the view / root home directory with a maximum of 3 layers:

[root@localhost ~] # dutree-d3. /

If you do not limit the number of directory layers, you can check the / root/test directory without adding the-d option:

[root@localhost ~] # dutree test/

Exclude a file

To exclude content that matches a file or directory name, use the-x option. The following excludes items that include dir1 in the test directory:

[root@localhost ~] # dutree-x dir1 test/

Using the-H option, you can exclude hidden files:

[root@localhost] # dutree-H

You can see that the hidden file is not listed.

The progress bar is displayed using ASCII characters

You can use the ASCII character # sign instead of the default progress bar:

This is the end of [root@localhost] # dutree-D1-A / root on "how to install and use Dutree under Linux". Thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report