View file size
When the disk size exceeds the standard, there will be an alarm prompt. At this time, it is a very wise choice to master the df and du commands.
df can view the first-level folder size, usage ratio, file system and its mount point, but it can do nothing about files.
You can check the size of files and folders with du.
The two are used together and are very effective. For example, use df to check which first-level directory is too large, and then use df to check the size of the folder or file, so that the crux can be quickly determined.
The following is a brief introduction
The df command can display the available space and usage of all file systems currently. Please see the following example:
The following is a code snippet:
[yayug@yayu ~]$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 3.9G 300M 3.4G 8% /
/dev/sda7 100G 188M 95G 1% /data0
/dev/sdb1 133G 80G 47G 64% /data1
/dev/sda6 7.8 G 218M 7.2G 3% /var
/dev/sda5 7.8G 166M 7.2G 3% /tmp
/dev/sda3 9.7G 2.5G 6.8G 27% /usr
tmp fs 2.0G 0 2.0G 0% /dev/shm
The parameter -h indicates using "Human-readable" output, that is, using easy-to-read formats such as GB and MB in the file system size.
The first field (Filesystem) and the last field (Mounted on) output by the above command are the file system and its mount point respectively. We can see that the partition /dev/sda1 is mounted in the root directory.
The next four fields Size, Used, Available, and Use% are respectively the capacity, used size, remaining size, and used percentage of the partition. Under FreeBSD, when the hard disk capacity is full, you may see that the used percentage exceeds 100%, because FreeBSD will leave some space for root, so that root can still write things to the file system when the file system is full. for management.
du: Query the disk space used by files or folders
If there are many files and folders in the current directory, use the command without parameter du to list the space used by all files and folders in a loop. This is not good for checking which area is too large, so you have to specify the number of layers deep into the directory. Parameter: --max-depth=, this is an extremely useful parameter! As shown below, pay attention to the use of "*" to get the usage space of the file.
Reminder: FreeBSD has always had more complex commands than Linux, but its du command specifies the number of layers deep into the directory is simpler than Linux, which is -d.
The following is the code snippet:
[root@bsso yayu]# du -h --max-depth=1 work/testing
27M work/testing/logs
35M work/testing
[root@bsso yayu]# du -h --max-depth=1 work/testing/*
8.0K work/testing/func.php
27M work/testing/logs
8.1M work/testing/nohup.out
8.0K work/testing/testing_c .php
12K work/testing/testing_func_reg.php
8.0K work/testing/testing_get.php
8.0K work/testing/testing_g.php
8.0K work/testing/var.php
[root@bsso yayu]# du -h --max-depth=1 work/testing/logs/
27M work/testing/logs/
[root@bsso yayu]# du -h --max-depth=1 work/testing/logs/*
24K work/testing/logs/errdate.log_show.log
8.0K work/testing/logs/pertime_show.log
27M work/testing/logs/show.log
It is worth noting that I saw a command for du and df Similar and different articles: "Du df differences lead to file system false alarm resolution".
du statistics file size summation
df statistics data block usage
If a process opens a large file and the large file is directly deleted by rm or mv, du will update the statistical value, but df will not update the statistical value, and it will still be considered that the space has not been released. Until the process that opens the large file is killed.
Therefore, when the files under /var/spool/clientmqueue are regularly deleted, if the process is not killed, the space will not be released.
Use the following command to kill the process and the system will recover.
fuser -u /var/spool/clientmqueue

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

Alipay PHP...

Do you want to provide real-time, instant solutions to your customers' most pressing problems? Live chat lets you have real-time conversations with customers and resolve their problems instantly. It allows you to provide faster service to your custom

Article discusses late static binding (LSB) in PHP, introduced in PHP 5.3, allowing runtime resolution of static method calls for more flexible inheritance.Main issue: LSB vs. traditional polymorphism; LSB's practical applications and potential perfo

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

Article discusses essential security features in frameworks to protect against vulnerabilities, including input validation, authentication, and regular updates.

The article discusses adding custom functionality to frameworks, focusing on understanding architecture, identifying extension points, and best practices for integration and debugging.

Sending JSON data using PHP's cURL library In PHP development, it is often necessary to interact with external APIs. One of the common ways is to use cURL library to send POST�...
