View the folder and file size in linux

Source: Internet
Author: User
1. the df command displays the available space and usage of all file systems [1]. command: df-hFilesystemSizeUsedAvailUse % Mountedon/dev/mapper/VolGroup00-LogVol0020G4.1G15G23 % // dev/mapper/VolGroup00 -...

 

1. the df command can display the available space and usage of all file systems.

[1]. Command: df-h

Filesystem Size Used Avail Use % Mounted on

/Dev/mapper/VolGroup00-LogVol00 20G 4.1G 15G 23%/

/Dev/mapper/VolGroup00-LogVol03 3.9G 638 M 3.1G 17%/var

/Dev/mapper/VolGroup00-LogVol02 2.0G 68 M 1.8G 4%/tmp

/Dev/cciss/c0d0p1 99 M 22 M 73 M 23%/boot

/Dev/mapper/VolGroup00-data 242G 124G 116G 52%/data0

Tmpfs 4.0G 0 4.0G 0%/dev/shm

Immdb2: 9421 3.0 T 503G 2.5 T 17%/mnt/mfs

The-h parameter indicates that "Human-readable" is used for output, that is, the file system uses readable formats such as GB and MB.

2. query the disk space used by files or folders

[1]. Command: du-h

This command is used to calculate the sum of file sizes. the result of adding subdirectories to the current directory is shown in

1.9G./communication

180 K./file/2011-12-06

244 K./file

36 K./meeting/2011-12-06

44 K./meeting

1.2G./action/2011-12-06

1.2G./action

...

11G.. www.2cto.com

[2]. Command: du-h [-path] to obtain the result of adding sub-directories under the specified directory, as shown in

Du-h ~

1.2 GB/u/imm/push/logs/2011-12-05

2.2G/u/imm/push/logs/2011-11-24

2.1G/u/imm/push/logs/2011-11-19

257 M/u/imm/push/logs/2011-10-15

1.8G/u/imm/push/logs/2011-11-16

1.4G/u/imm/push/logs/2011-11-07

102G/u/imm

[3]. Command: du-h [-path/*] to obtain the size of each file in a specified directory, as shown in

Du-h 2011-12-06/*. log

3.3M2011-12-06/job.2011-12-06-00-0.log

3.2M2011-12-06/job.2011-12-06-01-0.log

3.2M2011-12-06/job.2011-12-06-02-0.log

3.2M2011-12-06/job.2011-12-06-03-0.log

3.2 M 2011-12-06/job.2011-Log

3.2 M 2011-12-06/job.2011-Log

3.3 M 2011-12-06/job.2011-Log

3.3 M 2011-12-06/job.2011-12-06-07-0.log

3.3 M 2011-12-06/job.2011-12-06-08-0.log

From on-road

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.