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

What is the specific method of quickly finding large files in Linux system

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

Share

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

Linux system to quickly find large files of the specific way is, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can gain something.

It is well known that everything in the Linux system is a file, so there are many files in the Linux system, how to quickly find large files in the Linux system?

A specific way to quickly find large files in Linux systems.

I. the difference between df and du

Df,disk free, you can quickly get information such as how much space the hard disk is occupied and how much space is left. Du,disk usage, which shows the disk space usage and counts the amount of disk space occupied by directories (or files). Does it feel like it doesn't look any different on paper? Haha, there are actually many differences.

1. The scope of statistics is different

Df is to count the occupancy of each disk in the system as a whole, but not the size of specific folders or files.

Du can count both overall and the size of a specific file.

2. The calculation speed varies with different calculation methods.

Df acquires space size information quickly through the file system, which is fast and efficient.

Du enters each subdirectory of the specified directory step by step, calculates and adds each file size one by one, and finally displays it.

So the calculation speed is slow, when there are more files, when the files are larger, you have to wait a long time!

And because you want to enter each subdirectory to calculate the file size, it cannot be calculated if the current user does not have access to some folders.

3. The difference of calculation results.

Df can get deleted files, because df obtains the space size through the file system, when we delete a file, the file does not immediately disappear in the file system, but temporarily disappears. When all programs are not in use, the deleted files will be released according to the rules of OS. So when a file has just been deleted and emptied and not fully released, df will still count it. (you can use the df command to check before and after you delete a large file, which is still taking up disk space when you delete it.)

Du can only see files that currently exist and have not been deleted. The size he calculates is the sum of all the file sizes he thinks currently exist.

When the file system also confirms that the file has been deleted, the results of du and df are consistent.

So at this point, it can be said that the df calculation is more accurate, or it can be said that there is a delay in the df calculation, and the root can be used according to individual circumstances.

Let's take a look at how to use

II. The use of df and du

1. Df-h (the-h parameter makes the result in the unit of KMagazine G to improve the readability of the information)

When there are a lot of files in the directory, using-s is very useful when you only want to show the total file size.

2. Du-sh. / * (. / * specify current directory)

If you do not specify a directory, the size of all subdirectories under the current directory is displayed by default. In the case of a specified directory, all file sizes in the specified directory are displayed respectively. This is useful to find out which file is the largest.

Third, how to use the combination of df and du to find large files? 1. First, df-H2, du-sh. / *

Go to a directory that takes up a lot of space, or execute the command under a directory that you follow

3. You can clearly see the larger files in the listed files. Go to the corresponding directory and execute command 2 again, repeat until you find the final large file target and delete it.

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

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