The code is as follows |
Copy Code |
Du-b--max-depth 1 | Sort-nr | Perl-pe ' s{([0-9]+)}{sprintf "%.1f%s", $1>=2**30? ($1/2**30, "G"): $1>=2**20? ($1/2**20, "M"): $1>=2**10? ($1/2**10, "K"): ($, "")}e ' DU-SBH * Ls-lh |
Common parameters:
-A or--all displays disk usage for each specified file, or displays the respective disk usage for each file in the directory.
-B or--bytes displays the directory or file size in bytes.
-C or--total displays the sum of all directories or files in addition to the size of the directory or file.
-D or--dereference-args displays the source file size for the specified symbolic connection.
-H or--human-readable to k,m,g to improve the readability of the information.
The-H or--si is the same as the-h parameter, but the k,m,g is in 1000 as the conversion unit instead of 1024.
-K or--kilobytes in 1024 bytes.
-L or--count-links a file that calculates hardware connections repeatedly.
The source file size for the symbol connection specified in the-l< symbol connection > or--dereference< symbol connection > Display option.
-M or--megabytes is in 1MB.
-S or--summarize displays only totals, that is, the current directory size.
When-S or--separate-dirs displays the size of each directory, it does not contain the size of its subdirectories.
-X or--one-file-xystem the file system at the start of the process, and if you encounter a different file system directory, skip.
-x< files > or--exclude-from=< files > specify directories or files in < file >.
--exclude=< directory or File > skips the specified directory or file.
--max-depth=< the directory layer > beyond the specified number of layers, ignored.
--help display Help.
--version Displays version information.