View Disks
(1) view the file size
View the size of all files in the current folder (including subfolders)
Du-SH
# Du-H
15 m./package
16 K./. fontconfig
4.0 K./. Cache
5.1 m./. rpmdb
20 m.
View the size of all files in a specified folder (including subfolders)
# Du-H FTP
3.8 gb ftp/Sanya/doc
3.8 gb ftp/Sanya
4.0 k ftp/testftp/doc
1.4 m FTP/testftp
875 m FTP/platform/doc/002-video
27 m FTP/platform/doc/001-pdf
5.2 m FTP/platform/doc/bbflash
1.2 gb ftp/platform/doc/003-Recording
2.1 gb ftp/platform/doc
2.1 gb ftp/Platform
4.0 k ftp/PMO/doc
20 k FTP/PMO
36 m FTP/UF/doc/innovate-201207
36 m FTP/UF/doc
36 m FTP/UF
446 m ftp/code/doc
446 m ftp/code
6.3 GB FTP
View the size of a specified file
# Du-H./package/compat-libstdc ++-33-3.2.3-69.el6.x86_64.rpm
184 K./package/compat-libstdc ++-33-3.2.3-69.el6.x86_64.rpm
View the size of a specified folder
# Du-HS FTP
6.3 GB FTP
Usage: Du [Option]... [file]...
Or: Du [Option]... -- files0-from = f
Calculate the disk usage of each file and the total usage of the directory.
Parameters required for long options are also required for short options.
-A, -- all output the disk usage of all files, not just Directories
-- Apparent-size indicates the surface usage, not the disk usage. Although the surface usage usually
Small, but sometimes it is broken because of the "holes" between sparse files.
Film, non-directly referenced block, and so on.
-B, -- block-size = use the specified number of bytes.
-B, -- bytes equals to -- apparent-size -- block-size = 1
-C, -- total display total information
-D, -- dereference-ARGs unconnects the symbols 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 to -- dereference-ARGs (-d)
-H, -- human-readable display size in a readable way (for example, 1 K 234 M 2g)
-- Si is similar to-h, but 1000 is used as the base instead of 1024 in computing.
-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: locate 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 does 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 shows the total number of directories (use the computing file with -- all)
When N is a specified value, the calculation depth is N;
-- Max-depth = 0 equals -- summarize
-- Time: displays the last modification time of all files in a directory or subdirectory.
-- Time = word: display the word time, not 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.
[Size] can be the following unit (an integer can be added before the Unit ):
KB 1000, K 1024, MB 1000000, M 1048576, G, T, P, E, Z, and Y.
Report du errors
GNU coreutils project home page: GNU software general help: Report du translation errors to
(2) Ubuntu command for viewing disk space
The DF-h df command is used in Linux to view the file system by disk partition. You can add parameters to view the remaining disk space. The command format is DF-Hl: file System capacity in use available % mount point filesystem size used avail use % mounted on/dev/hda2 45g 19G 24g 44%/dev/hda1 494
DF-H
The DF command is used to view the file system by disk partition in Linux. You can add parameters to view the remaining disk space. The command format is as follows:
DF-Hl
Display format:
File System capacity used available % mount point
Filesystem size used avail use % mounted on
/Dev/hda2 45g 19G 24g 44%/
/Dev/hda1 494 M 19 m 450 m 4%/boot
/Dev/hda6 4.9g 2.2g 2.5g 47%/home
/Dev/hda5 9.7g 2.9g 6.4g 31%/OPT
None 1009 M 0 1009 M 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%/
The preceding output is used as an example to indicate:
HD hard disk interface second hard disk (B), second partition (2), capacity is 75g, 75g used, available is 0, so the utilization is 100%, mounted to the root partition directory (/).
The following is an explanation of the relevant commands:
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.
For more functions, run the following command:
DF -- Help
Du -- Help
(Responsible editor: Admin)
(3) Delete log files
Today, I saw that the company's Linux server has not put anything, but it has already used 50%. I checked that the log file was too large, so I deleted it manually,
This is faster
Sudo/dev/null>/var/log/**. Log
We recommend that you use
Sudo find/var/log/-type F-mtime + 30-exec Rm-F {}\;
Delete old files 30 days ago
DF and DH