In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article is about how linux replaces the du command. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
Ncdu
Ncdu is already popular in the Linux community as a substitute for normal du. Ncdu is developed based on developers' dissatisfaction with the performance of du. Ncdu is a simple and fast disk usage analyzer developed using C language and ncurses interface, which can be used to see how directories or files take up disk space on local or remote systems. If you are interested in seeing a detailed introduction to ncdu, you can browse to the article "how to use ncdu on Linux to see disk usage".
Tin-summer
Tin-summer is a free and open source tool written in the Rust language that can be used to find files that take up disk space and is another alternative to the du command. Because of the use of multithreading, tin-summer can calculate the size of a large directory much faster than the du command. The difference between the tin-summer and du commands is that the former reads the size of the file, while the latter reads disk usage.
The developers of tin-summer think it can replace du because it has the following advantages:
It is faster than du in operating large directories.
The display results are in an easy-to-read format by default
You can use regular expressions to exclude files or directories
Output can be sorted and shaded
Scalable, etc.
Install tin-summer
To install tin-summer, simply execute the following command in the terminal:
$curl-LSfs https://japaric.github.io/trust/install.sh | sh-s-git vmchale/tin-summer
You can also install tin-summer using the cargo package manager, but you need to install Rust on the system first. With Rust already installed, execute the following command:
$cargo install tin-summer
If neither of the above methods can successfully install tin-summer, you can also download the * version of the binaries from its software release page and install it manually.
Usage
(LCTT translation note: the command name of tin-summer is sn)
If you need to see the file size of the current working directory, you can execute the following command:
$sn f749 MB. / .rustup / toolchains749 MB. / .rustup147 MB. / .cards / bin147 MB. / .cargo900 MB.
No additional declaration is required, and by default the data is presented to the user in an easy-to-read format. When using the du command, you must add an additional-h parameter to get the same effect.
You can view the file size of a particular directory simply by executing the command as follows.
$sn f
You can also sort the output, for example, the following command can output 5 files or directories in the specified directory:
$sn sort / home/sk/-n5749 MB / home/sk/.rustup749 MB / home/sk/.rustup/toolchains147 MB / home/sk/.cargo147 MB / home/sk/.cargo/bin2.6 MB / home/sk/mcelog900 MB / home/sk/
By the way, the * * line in the above result is the total size of the specified directory / home/sk. So don't be surprised why the input is 5 and the actual output is 6 lines.
To find the directory with the build project under the current directory, you can use the following command:
$sn ar
Tin-summer also supports finding directories with build projects of a specified size. For example, execute the following command to find directories with construction projects with a size greater than 100 MB:
$sn ar-t100m
As mentioned above, tin-summer is faster when working with large directories, so it is relatively slow when working with small directories. However, its developers have indicated that this defect will be optimized in future releases.
To get help, you can execute the following command:
$sn-help
For more details, check out the project's GitHub page.
Dust
Dust (which means du + rust = dust) is written in Rust and is a free, open source, more intuitive du tool. It can instantly display the disk space occupied by the directory without the need for head or sort commands. Like tin-summer, it displays the size of each directory in an easy-to-read format by default.
Install dust
Because dust is also written in Rust, it can also be installed through the cargo package manager:
$cargo install du-dust
You can also download the * binaries from its software release page and install them by following these steps. At the time of writing, the version of * is 0.3.1.
$wget https://github.com/bootandy/dust/releases/download/v0.3.1/dust-v0.3.1-x86_64-unknown-linux-gnu.tar.gz
Extract files:
$tar-xvf dust-v0.3.1-x86_64-unknown-linux-gnu.tar.gz
* copy the executable file to your $PATH (e.g. / usr/local/bin):
$sudo mv dust / usr/local/bin/
Usage
To view the file sizes in the current directory and all subdirectories, you can execute the following command:
$dust
Sample output:
The-p parameter can be displayed as the full directory starting from the current directory.
$dust-p
Dust 2
If you need to see the size of multiple directories, you only need to list them at the same time and separate them with spaces:
$dust
Here are a few more examples, such as:
Displays the length of the file:
$dust-s
Only 10 directories are displayed:
$dust-n 10
View a maximum of 3 subdirectories under the current directory:
$dust-d 3
View help:
$dust-h
For more details, check out the project's GitHub page.
Diskus
Diskus is also a small, fast open source tool written in Rust that can be used as an alternative to the du-sh command. Diskus will calculate the total size of all files in the current directory, which is equivalent to du-sh or du-sh-- bytes, but its developers say diskus runs nine times faster than du-sh.
Install diskus
Diskus is already stored in the Arch Linux community user software repository Arch Linux User-community Repository (AUR) and can be installed on Arch-based systems through any of the AUR help tools, such as yay:
$yay-S diskus
For Ubuntu and its derivative distributions, you can download and install the * * version of the software package on the software release page of diskus:
$wget "https://github.com/sharkdp/diskus/releases/download/v0.3.1/diskus_0.3.1_amd64.deb" $sudo dpkg-I diskus_0.3.1_amd64.deb
You can also install diskus using the cargo package manager, but you must first install Rust 1.29+ on your system.
Once Rust is installed, you can install diskus using the following command:
$cargo install diskus
Usage
Normally, if I need to look at the size of a directory, I use a command like du-sh.
$du-sh dir
The-s parameter here indicates the total size of the display.
If you use diskus, you can directly display the total size of the current directory.
$diskus
I use diskus to check the total size of various directories on my Arch Linux system, and this tool is really much faster than du-sh. But currently it can only display the size of the current directory.
To get help, you can execute the following command:
$diskus-h
For more details, check out the project's GitHub page.
Duu
Duu is the abbreviation of Directory Usage Utility. It is a tool written in Python to view the specified directory size. It is cross-platform, so it can be used on Windows, Mac OS and Linux systems.
Install duu
You need to install Python 3 before installing this tool. However, many Linux distributions currently have Python 3 in their default software repositories, so this dependency is not difficult to solve.
After the installation of Python 3 is complete, download the * version of duu from the software release page.
$wget https://github.com/jftuga/duu/releases/download/2.20/duu.py
Usage
To see the size of the current directory, simply execute the following command:
$python3 duu.py
Sample output:
As you can see from the figure above, duu shows the number of files in the current directory, showing the total size of these files in Byte, KB, and MB units, as well as the size of each file.
If you need to check the size of a directory, you only need to declare the absolute path of the directory:
$python3 duu.py / home/sk/Downloads/ Thank you for reading! This is the end of the article on "how to replace the du command with linux". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.