Ubuntu view files and disk space size management

Source: Internet
Author: User
Tags readable disk usage

Ubuntu view files and disk space size management (1) View file size View all file sizes (including subfolders) under the current folder Du-sh # Du-h
15M./package
16K./.fontconfig
4.0K./.cache
5.1M./.rpmdb
20M. View all file sizes (including sub-folders) under the specified folder # du-h FTP
3.8G Ftp/sanya/doc
3.8G Ftp/sanya
4.0K Ftp/testftp/doc
1.4M ftp/testftp
875M ftp/platform/doc/002-Video
27M ftp/platform/doc/001-pdf
5.2M Ftp/platform/doc/bbflash
1.2G ftp/platform/doc/003-Recording
2.1G Ftp/platform/doc
2.1G Ftp/platform
4.0K Ftp/pmo/doc
20K FTP/PMO
36M ftp/uf/doc/innovate-201207
36M Ftp/uf/doc
36M Ftp/uf
446M Ftp/code/doc
446M Ftp/code
6.3G FTP View specified file size # du-h./package/compat-libstdc++-33-3.2.3-69.el6.x86_64.rpm
184K./package/compat-libstdc++-33-3.2.3-69.el6.x86_64.rpm view specified folder size # DU-HS FTP
6.3G FTP

Usage: du [options] ... [File] ...
Or: du [options] ...--files0-from=f
Calculate the disk usage for each file, and the directory will take the total amount.

The long option must use parameters that are also required for short options.
-A,--all the disk usage of all files, not just the directory
--apparent-size displays surface dosage, not disk usage, although surface dosage is usually
Smaller, but sometimes it can be because of the "hole" between sparse files, internal broken
Not directly referenced blocks, and other reasons.
-B,--block-size= size block with specified number of bytes
-B,--bytes equals--apparent-size--block-size=1
-C,--total display total information
-D,--dereference-args remove symbolic connections listed on the command line
--files0-from=f the file name that ends with NUL in the computed files F corresponds to the disk space occupied
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 more readable manner (e.g. 1K 234M 2G)
--si is similar to-H, but uses 1000 as the base instead of 1024 when calculating
-K equals--block-size=1k
-L,--count-links if it is a hard connection, calculate its dimensions multiple times
-M equals--block-size=1m
-L,--dereference find out the true destination of any symbolic link indication
-P,--no-dereference does not follow any symbolic link (default)
-0,--null each blank line as 0 bytes instead of line break
-S,--separate-dirs does not include the amount of sub-directories
-S,--summarize only calculates the total amount of each parameter in the command column separately
-X,--one-file-system skips directories on different file systems
-X,--exclude-from= file excludes files that match the pattern described in the specified file
--exclude=pattern exclude files that match the patterns described in pattern
--max-depth=n Show catalog totals (use calculation files with--all)
When n is the specified value, the calculation depth is n;
--max-depth=0 equals--summarize.
--time Displays the last modified time for all files in the directory or subdirectory
--time=word Displays the WORD time, not the modified time:
Atime,access,use,ctime or Status
The--time-style= style displays the time in the specified style (the style interpretation rule is the same as the "date" command):
Full-iso,long-iso,iso,+format
--HELP Display this help message and exit
--version display version information and exit

[Size] can be the following unit (the unit is preceded by an integer):
KB 1000,k 1024,mb 1000000,m 1048576, also G, T, P, E, Z, Y.

Please report to Du's error
GNU coreutils Project Home:GNU Software general help:Please report du's translation errors to

(2) Ubuntu view disk space size command df-h DF command is a Linux system to view the file system as a disk partition, you can add parameters to view the disk remaining space information, command format: DF-HL display format: File system capacity has been used to use the% mount point Filesystem Size used Avail use% mounted on/dev/hda2 45G 19G 24G 44%//dev/hda1 494

Df-h

The DF command is a Linux system that views the file system as a disk partition, which can be added with parameters to view the disk's remaining space information, command format:

Df-hl

The display format is:

File system capacity has been used with available% mount points

Filesystem Size used Avail use% mounted on

/dev/hda2 45G 19G 24G 44%/

/DEV/HDA1 494M 19M 450M 4%/boot

/dev/hda6 4.9G 2.2G 2.5G 47%/Home

/dev/hda5 9.7G 2.9G 6.4G 31%/opt

None 1009M 0 1009M 0%/dev/shm

/dev/hda3 9.7G 7.2G 2.1G 78%/usr/local

/DEV/HDB2 75G 75G 0 100%/

/DEV/HDB2 75G 75G 0 100%/

With the above output as an example, the meaning of the expression is:

The second hard drive interface (b), the second partition (2), the capacity is 75G, with 75G, usable is 0, so the utilization is 100%, is mounted to the root partition directory (/).

The following is an explanation of the relevant commands:

DF-HL Viewing disk space remaining

Df-h viewing the partition size for each root path

Du-sh [directory Name] Returns the size of the directory

DU-SM [Folder] Returns the total number of M in this folder

More functions you can enter the command to view:

DF--help

Du--help

(Editor: admin) (3) Delete log file Today, the company's Linux server did not put anything, but has been used 50%, a view of the original log file is too large, and then manually deleted, this relatively fast
Sudo/dev/null >/var/log/**.log below this can be recommended using sudo find/var/log/-type f-mtime +30-exec rm-f {} \; Delete old files 30 days ago

Ubuntu view files and disk space size management

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.