Linux du little Exercise

Source: Internet
Author: User
Tags disk usage

[email protected]:~/shell$ ls
1.txt man.config man.config~ test.sh test.sh~

It shows that there are five files below the/shell, now the size of each file is to be typed separately, what to do with du command.

Think, the answer is below, with the mouse scan is visible.

[Email protected]:~/shell$ for i in ' ls '; Do du-sh $i; Done
25M 1.txt
8.0K Man.config
0 man.config~
4.0K test.sh
4.0K test.sh~
Haha, correct it.

Here are some common distinctions of DU

The Linux du command also looks at the space used, but unlike the DF command, the Linux du command is a view of the space used by the file and directory disks, or some difference from the DF command.

1. Command format:

du [Options] [file]

2. Command function:

Displays the disk usage space for each file and directory.

3. Command parameters:

-A or-all displays the size of individual files 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 individual directories or files.

-K or--kilobytes output in kilobytes (1024bytes).

-M or--megabytes is output in megabytes.

-S or--summarize displays only the totals, listing only the last added total value.

-H or--human-readable in k,m,g to improve the readability of the information.

-X or--one-file-xystem the file system at the beginning of the processing, if any other different file system directories are skipped.

-l< the source file size of the symbolic link specified in the Symbolic link > or--dereference< symbolic link > Display option.

-S or--separate-dirs displays the size of individual directories without the size of their subdirectories.

-x< file > or--exclude-from=< file > in < file > specify directory or file.

--exclude=< directory or File > skip the specified directory or file.

-D or--dereference-args displays the source file size for the specified symbolic link.

-H or--si is the same as the-h parameter, but the k,m,g is converted to 1000 units.

-L or--count-links duplicates the hardware-linked files.

Linux du little Exercise

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.