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 mainly introduces how to find duplicate files in the linux system and quickly release disk space, the article is very detailed, has a certain reference value, interested friends must read it!
1. Use the diff command to compare files
In our normal operation, the easiest way to compare the differences between two files is probably to use the diff command. The output of the diff command will use the
< 和 >The symbol shows the difference between the two files, and using this feature we can find the same file.
When there are differences between the two files, the diff command outputs the differences:
$diff index.html backup.html 2438a2439J 2441 > > That's all there is to report. >
If your diff command has no output, it means the two files are the same:
$diff home.html index.html $
However, the disadvantage of the diff command is that it can only compare two files at a time, which must be very inefficient if we want to compare multiple files.
two。 Use checksum
The checksum command cksum calculates the contents of the file into a very long number (such as 2819078353 228029) according to a certain algorithm. Although the results are not absolutely unique, the possibility that different documents will lead to the same checksum is similar to that of the Chinese men's football team in the World Cup.
$cksum *. Html 2819078353 228029 backup.html 4073570409 227985 home.html 4073570409 227985 index.html
In our above operation, we can see that the second and third file checksums are the same, so we can assume that the two files are the same.
3. Use the find command
Although the find command does not have the option to find duplicate files, it can be used to search for files by name or type and run the cksum command. The specific operation is as follows.
$find. -name "* .html"-exec cksum {}\; 4073570409 227985. / home.html 2819078353 228029. / backup.html 4073570409 227985. / index.html
4. Use the fslint command
The fslint command can be used specifically to find duplicate files. But there is a note here, that is, we need to give it a starting position. If we need to run a large number of files, this command may take a long time to complete the lookup.
$fslint. -file name lint-Invalid utf8 names-file case lint -DUPlicate files
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.