In Linux, check the folder size, disk space remaining (du/df), and dudf.

Source: Internet
Author: User
Tags disk usage

In Linux, check the folder size, disk space remaining (du/df), and dudf.
1. Introduction

View the directory size in du, and view the disk usage in df.

2. du

Disk usage
(1) Basic functions
Recursively view the size of all files in a folder
(2) common parameters:
-H,-human-readable Display dimensions in a readable manner (for example, 1 K 234 M 2G)
-S,-summarize only calculates the total usage of each parameter in the Command column.
(3) other parameter descriptions:
-A,-all outputs the disk usage of all files, not just Directories
-Apparent-size indicates the surface usage, not the disk usage. Although the surface usage is usually smaller, but sometimes it will become larger because of "holes" between sparse files, internal fragments, non-directly referenced blocks, and other reasons.
-B,-block-size = use the specified number of bytes.
-B,-bytes equals-apparent-size-block-size = 1
-C,-total display total information
-D,-dereference-args remove the symbolic connections listed in the command line
-Files0-from = F calculate the disk space occupied by the file name ending with NUL in file F if the value of F is "-", the file name is read from the standard input
-H equals-dereference-args (-D)
-H,-human-readable Display dimensions in a readable manner (for example, 1 K 234 M 2G)
-Si is similar to-h, but 1000 is used as the base instead of 1024 During computation.
-K equals-block-size = 1 K
-L,-count-links: if it is a hard connection, the size is calculated multiple times.
-M equals-block-size = 1 M
-L,-dereference: Find the real destination indicated by any Symbolic Link
-P,-no-dereference does not follow any Symbolic Link (default)
-0,-null treats each blank line as 0 bytes rather than line breaks
-S,-separate-dirs do not include the usage of sub-Directories
-S,-summarize only calculates the total usage of each parameter in the Command column.
-X,-one-file-system skips directories on different file systems
-X,-exclude-from = exclude files that match the pattern described in the specified file
-Exclude = PATTERN: exclude files that match the PATTERN described in PATTERN.
-Max-depth = N: displays the total number of directories (computing files are used with-all)
When N is a specified value, the calculation depth is N;
-Max-depth = 0 equals to-summarize
-Time: displays the last modification time of all files in a directory or subdirectory.
-Time = WORD: display the WORD time, rather than the modification time: atime, access, use, ctime, or status
-Time-style = display time of the style according to the specified style (style interpretation rules are the same as the "date" command ):
Full-iso, long-iso, iso, + FORMAT
-Help: displays the help information and exits.
-Version: displays the version information and exits.

3. df

Df-hl view the remaining disk space
Df-h: view the partition size of each root path
Du-sh [directory name] returns the directory size
Du-sm [Folder] returns the total number of MB in this folder.

4. Differences

Du is a file-oriented command that only calculates the space occupied by the file, not the space occupied by the file system metadata.
Df is calculated based on the file system population. No space is allocated in the file system to determine the size of allocated space in the system. The df command can obtain the space occupied by the hard disk and the remaining space. It can also display the I node and disk block usage of all file systems.

Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.