1、  显示目前所有文件系统的可用空间及使用情形,h表示使用 GB、MB 等易读的格式

[root@rusky ldap]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 3.8G 1.9G 1.8G 51% /
/dev/sda1 46M 9.2M 35M 22% /boot
tmpfs 506M 0 506M 0% /dev/shm
/dev/sda3 14G 2.5G 11G 19% /home
.host:/ 83G 38G 46G 45% /mnt/hgfs   ----这个是挂载的主机与vmware共享文件夹所在的分区情况

2、查看该文件夹的总大小

du -sh  查看当前目录大小,-s表示显示目录总大小,否则,列出该目录下所有子目录文件大小

[root@rusky ldap]# du -h --max-depth=0 apache-tomcat-6.0.37   或者直接进入该目录下,使用命令:du -sh即可查询
5.3M apache-tomcat-6.0.37

3、 显示bin目录的大小

[root@rusky ldap]# du -h --max-depth=0 apache-tomcat-6.0.37/bin
323K apache-tomcat-6.0.37/bin

4、显示apache-tomcat-6.0.37这个文件夹里各个文件或文件夹的大小

[root@rusky ldap]# du -h --max-depth=0 apache-tomcat-6.0.37/*
324K apache-tomcat-6.0.37/bin
100K apache-tomcat-6.0.37/conf
2.7M apache-tomcat-6.0.37/lib
19K apache-tomcat-6.0.37/LICENSE
0 apache-tomcat-6.0.37/logs
512 apache-tomcat-6.0.37/NOTICE
4.5K apache-tomcat-6.0.37/RELEASE-NOTES
8.5K apache-tomcat-6.0.37/RUNNING.txt
0 apache-tomcat-6.0.37/temp
2.2M apache-tomcat-6.0.37/webapps
0 apache-tomcat-6.0.37/work

5、查看单个文件的大小

[root@rusky bin]# du -h bootstrap.jar
12K bootstrap.jar

====================

du 用来查看某个目录所占空间大小
语法:du [-abckmsh] [文件或者目录名] 常用的参数有:
-a:全部文件与目录大小都列出来。如果不加任何选项和参数只列出目录(包含子目录)大小。
-b:列出的值以bytes为单位输出,默认是以Kbytes
-c:最后加总
-k:以KB为单位输出
-m:以MB为单位输出
-s:只列出总和
-h:系统自动调节单位,例如文件太小可能就几K,那么就以K为单位显示,如果大到几G,则就以G为单位显示。常用du –sh filename

[root@rhel7 /]# du -sh /usr
803M /usr
[root@rhel7 /]# du -ch /usr/ --递归目录里所有文件,列出大小,最后总和。
......
.0K /usr/libexec/os-probes/init
.0K /usr/libexec/os-probes/mounted/efi
68K /usr/libexec/os-probes/mounted
80K /usr/libexec/os-probes
24K /usr/libexec/plymouth
/usr/libexec/tuned
32K /usr/libexec/man-db
8.2M /usr/libexec/postfix
12M /usr/libexec
/usr/local/bin
/usr/local/etc
/usr/local/games
/usr/local/include
/usr/local/lib
/usr/local/lib64
/usr/local/libexec
/usr/local/sbin
/usr/local/share/applications
/usr/local/share/info
/usr/local/share/man/man1
/usr/local/share/man/man1x
/usr/local/share/man/man2
/usr/local/share/man/man2x
/usr/local/share/man/man3
/usr/local/share/man/man3x
/usr/local/share/man/man4
/usr/local/share/man/man4x
/usr/local/share/man/man5
/usr/local/share/man/man5x
/usr/local/share/man/man6
/usr/local/share/man/man6x
/usr/local/share/man/man7
/usr/local/share/man/man7x
/usr/local/share/man/man8
/usr/local/share/man/man8x
/usr/local/share/man/man9
/usr/local/share/man/man9x
/usr/local/share/man/mann
.0K /usr/local/share/man
.0K /usr/local/share
/usr/local/src
.0K /usr/local
/usr/src/debug
/usr/src/kernels
/usr/src
803M /usr/
803M total
[root@rhel7 /]# du -h --max-depth= /usr/ ----该命令等同于:du -sh /usr
803M /usr/
[root@rhel7 /]# du -h --max-depth= /usr/ ---统计第1级目录的大小,最后也有总的大小
54M /usr/bin
38M /usr/sbin
372M /usr/lib
123M /usr/lib64
202M /usr/share
/usr/etc
/usr/games
5.3M /usr/include
12M /usr/libexec
.0K /usr/local
/usr/src
803M /usr/
[root@rhel7 /]#

linux查看文件大小df-du的更多相关文章

  1. Linux查看文件大小命令

    Linux查看文件大小命令 du命令 (1)du -b filepath 参数-b表示以字节计数 du -b filepath 参数-b表示以字节计数 #示例: $ du -b ~/Downloads ...

  2. Linux查看文件大小5个常用命令

    1. 前言 Linux 系统有非常好用的命令,功能也非常丰富,如果你对命令行工具熟悉,可以非常高效率完成维护工具.本文主要介绍Linux系统中,用于查看文件大小的命令. Linux 查看文件大小5个常 ...

  3. 【linux】linux查看文件大小,磁盘大小

    查看指定目录下 文件或目录大小超过多少的 查看 /backup/tomcat7/ 目录下 超过500M大小的文件 并展示 文件详情 find /backup/tomcat7/  -type f -si ...

  4. linux 查看磁盘、文件夹、文件大小(df du)

    du 查看文件夹大小 1.查看当前文件夹中所有文件夹及其子文件夹的大小,注意是文件夹大小,不是文件 # du -h -rw-r--r-- 1 root root 82785865 6月 9 15:53 ...

  5. Linux编程 8 (挂载mount,查看磁盘df du,搜索grep,压缩zgip,归档tar)

    一. 挂载存储媒体 linux文件系统将所有的磁盘都并入一个虚拟目录下,当使用新的存储媒体之前,需要把它放到虚拟目录下,这项工作称为挂载(mounting) 1.1 mount 命令 在linux上用 ...

  6. Linux 查看文件大小并按照大小排序

    使用df 命令查看当前系统磁盘的使用情况: [root@node ~]# df -Th Filesystem Type Size Used Avail Use% Mounted on /dev/map ...

  7. Linux查看文件大小

    //查看系统中文件的使用情况 df -h //查看当前目录下各个文件及目录占用空间大小 du -sh * //查看welcome.txt文件占用空间大小 du -sh welcome.txt //方法 ...

  8. Unix/Linux 查看文件大小

    ls -l help.html-rw-r--r--  1 william  wheel  40960 Jul 18 00:59 development.sqlite3 40960 就是文件的大小. d ...

  9. Linux 常用命令——df, du, ln

    1. df 列出文件系统的整体磁盘使用量 2. du 评估文件系统的磁盘使用量(常用在推估目录所占容量),也可以计算文件或文件夹大小 3. ln 创建实体连接(hard link) 或 符号连接(Sy ...

随机推荐

  1. 在Oracle中查询表的大小、表的占用情况和表空间的大小

    转载自http://blog.csdn.net/cuker919/article/details/8514253 select segment_name, bytes as 大小 from user_ ...

  2. JAVA-1-HelloWorld

    public class HelloWorld{ public static void main(String[] args){ System.out.println("HelloWorld ...

  3. securecrt简介

    SecureCRT是最常用的终端仿真程序,简单的说就是Windows下登录UNIX或Liunx服务器主机的软件,本文主要介绍SecureCRT的使用方法和技巧 VanDyke CRT 和 VanDyk ...

  4. Ubuntu最小化桌面快捷键Super+D不生效解决

    之前用的Debian,最近研发老大让统一使用Ubuntu来开发,安装了Ubuntu 15.10之后,设置了最小化桌面的快捷键为Super+D(在Systm Settings/系统设置—>Keyb ...

  5. 【Ecstore2.0】导出问题解决(未导出或导出文件为0字节)

    如果导出队列能成功执行(队列不执行看这里)但是并未生成文件,那么原因大部份可能是出在FTP上. ECSTORE2.0采用了PHP的FTP模块,所以先确认你的环境是否安装了FTP模块,如果没有,安装并在 ...

  6. python 基础,包括列表,元组,字典,字符串,set集合,while循环,for循环,运算符。

         1.continue 的作用:跳出一次循环,进行下一次循环      2.break 跳出不再循环      3.常量 (全是大写)NAME = cjk  一般改了会出错      4.py ...

  7. Objective C内存管理之理解autorelease------面试题

    Objective C内存管理之理解autorelease   Autorelease实际上只是把对release的调用延迟了,对于每一个Autorelease,系统只是把该Object放入了当前的A ...

  8. fatal error C1083: Cannot open include file: 'qttreepropertybrowser.moc': No such file or directory

    编译QtPropertyBrowser的时候出错.要用moc来生成.moc文件.我好奇的是与之前的通过.h生成moc_xxx.cpp不一样. 要用以下命令.一般来说是处理带Q_OBJECT宏的.h文件 ...

  9. BZOJ3397: [Usaco2009 Feb]Surround the Islands 环岛篱笆

    3397: [Usaco2009 Feb]Surround the Islands 环岛篱笆 Time Limit: 3 Sec  Memory Limit: 128 MBSubmit: 11  So ...

  10. Linux企业级项目实践之网络爬虫(26)——线程池

    一旦有一个抓取请求开始,就创建一个新的线程,由该线程执行任务,任务执行完毕之后,线程就退出.这就是"即时创建,即时销毁"的策略.尽管与创建进程相比,创建线程的时间已经大大的缩短,但 ...