Linux: Find Out Directory Size Command
2014-03-28 00:00
274 查看
I
am a new Linux user. How do I find out size of a directory on Linux operating systems using command line options?
You need to use the du command:
[a] Find and estimate file space usage.
Summarize disk usage of each FILE/Directory/Folder.
[c] Shows the sizes of directories and files.
du
du dirName
du [options] dirName
du
Sample outputs:
Fig.01: du command in action
To find information about /etc and /home/nixcraft directory, enter:
du /path/to/dir
du /etc
du /home/nixcraft
du /root /home/nixcraft
Pass the -h option to get output in human readable format i.e. show output in kilobytes (K), megabytes (M) and gigabytes (G):
du -h /etc
du -h /dir1/file2
du -h /root
du -h
Sample outputs:
Pass the -s option to see the total disk space used by a directory:
du -sh
du -sh /etc/
du -sh /etc /home/ /securebackup/
Sample outputs:
Pass the -c to see a grand total for all of the files, type:
du -csh /root/ /etc/ /home/
Sample outputs:
[b] SEE ALSO
UNIX disk usage command examples - include command line tool such as du, df, ncdu, and GUI tools.
See du command man page for more information and examples.
am a new Linux user. How do I find out size of a directory on Linux operating systems using command line options?
You need to use the du command:
[a] Find and estimate file space usage.
Summarize disk usage of each FILE/Directory/Folder.
[c] Shows the sizes of directories and files.
Syntax
The basic syntax is:du
du dirName
du [options] dirName
Examples
Without any options, du command shows the names and used space for each directories including all sub-directories in the current directory:du
Sample outputs:
Fig.01: du command in action
To find information about /etc and /home/nixcraft directory, enter:
du /path/to/dir
du /etc
du /home/nixcraft
du /root /home/nixcraft
Pass the -h option to get output in human readable format i.e. show output in kilobytes (K), megabytes (M) and gigabytes (G):
du -h /etc
du -h /dir1/file2
du -h /root
du -h
Sample outputs:
8.0K ./.vim 24K ./scripts 48K ./.ssh 16K ./.keychain 2.2M ./.lftp 2.4M .
Pass the -s option to see the total disk space used by a directory:
du -sh
du -sh /etc/
du -sh /etc /home/ /securebackup/
Sample outputs:
4.1M /etc 152K /home/ 902M /securebackup/
Pass the -c to see a grand total for all of the files, type:
du -csh /root/ /etc/ /home/
Sample outputs:
2.4M /root/ 4.1M /etc/ 152K /home/ 6.6M total
[b] SEE ALSO
UNIX disk usage command examples - include command line tool such as du, df, ncdu, and GUI tools.
See du command man page for more information and examples.
相关文章推荐
- Linux Find Out Virtual Memory PAGESIZE
- Get and display the size of file and directory in Linux system using du command 获取和现实linux文件大小(三)
- Linux Find Out Last System Reboot Time and Date Command
- linux find command usage
- How do I Find Out Linux CPU Utilization?
- Find Out Top Ten Largest Files in Linux
- Linux / UNIX: Find out or determine if process pid is running
- 15 Practical Linux Find Command Examples
- 查看 Linux 发行名称和版本(HowTo: Find Out My Linux Distribution Name and Version)
- linux find命令使用 「25 simple examples of Linux find command」
- How do I find out what version of Linux I'm running?
- How do I find out Linux Resource utilization to detect system bottlenecks?
- linux command not find
- Linux find command (Under Ubuntu 12.04 Precise Pangolin)
- Mommy, I found it! — 15 Practical Linux Find Command Examples(PART 1)
- Mommy, I found it! — 15 Practical Linux Find Command Examples
- linux下提示:command not find解决方法
- ubuntu下arm-linux-gcc已安装,root用户使用却显示command not find
- Find command usage in Linux with excellent examples--reference
- linux find command