热门标签 | HotTags
当前位置:  开发笔记 > 后端 > 正文

教你了解Linux文件系统的使用情况

文章标题:教你了解Linux文件系统的使用情况。Linux是中国IT实验室的一个技术频道。包含桌面应用,Linux系统管理,内核研究,嵌入式系统和开源等一些基本分类

    主要涉及df、du、ls等命令

    df统计文件系统的使用情况。

    英文说明:

    This manual page documents the GNU version of df. df displays theamount of disk space available on the filesystem containing each filename argument. If no file name is given , the space available on alcurrently mounted filesystems is shown. Disk space is shown in 1K blocksby default, unless the environment variable POSIXLY_CORRECT

    is set, in which case 512-byte blocks are used.

    If an argument is the absolute file name of a disk device node containinga mounted filesystem, df shows the space available on that filesystemrather than on the filesystem containing the device node(which is alwaysthe root filesystem )。 This version of df cannot show the space availableon unmounted filesystems, because on most kinds of systems doing so requiresvery nonportable intimate knowledge of filesystem structures.

    要点如下:

    如果不加参数,显示现在加载的文件系统。默认单位1K-blocks.如果设置了POSIXLY_CORRECT ,则以512-byte blocks 为单位。该命令针对文件系统,而不是目录,尽管的给的参数可以是目录。

    主要参数:

    空显示现在加载的文件系统,不包含0 块空间

    -a包含0 块空间

    -h 易读方式

    -k kB为单位

    -l 本地

    -T 显示文件系统类型

    ——sync返回结果前调用sync命令(有什么用呢?)

    实例:

    [root@Mother_FLASH ~]# df

    Filesystem 1K-blocks Used Available Use% Mounted on

    /dev/md0 28826556 1507948 25854292 6% /usr

    /dev/md1 19220436 9153312 9090780 51% /var

    /dev/ram1 158667 85032 73635 54% /

    /dev/shm 1037388 0 1037388 0% /dev/shm

    [root@Mother_FLASH ~]# df -ah

    Filesystem Size Used Avail Use% Mounted on

    /dev/md0 28G 1.5G 25G 6% /usr

    /dev/md1 19G 8.8G 8.7G 51% /var

    /dev/ram1 155M 84M 72M 54% /

    /dev/proc 0 0 0 - /proc

    /dev/sys 0 0 0 - /sys

    /dev/devpts 0 0 0 - /dev/pts

    /dev/shm 1014M 0 1014M 0% /dev/shm

    none 0 0 0 - /proc/sys/fs/binfmt_misc

    详细的参考:

    -a,——all

    include filesystems having 0 blocks

    -B,——block-size=SIZE use SIZE-byte blocks

    -h,——human-readable

    print sizes in human readable format(e.g., 1K 234M 2G )

    -H,——si

    likewise, but use powers of 1000 not 1024

    -i,——inodes

    list inode information instead of block usage

    -k like ——block-size=1K

    -l,——local

    limit listing to local filesystems

    ——no-sync

    do not invoke sync before getting usage info(default )

    -P,——portability

    use the POSIX output format

    ——sync invoke sync before getting usage info

    -t,——type=TYPE

    limit listing to filesystems of type TYPE

    -T,——print-type

    print filesystem type

    -x,——exclude-type=TYPE

    limit listing to filesystems not of type TYPE

    -v(ignored )

    ——help display this help and exit

    ——version

    output version information and exit

    SIZE may be (or may be an integer optionally followed by ) one of
following : kB 1000, K 1024 , MB 1000*1000 , M

    1024*1024 , and so on for G, T, P, E, Z, Y.

    df统计每一目录的使用情况。

    主要参数:

    空显示现在加载的文件系统,不包含0 块空间

    -a统计所有目录和文件,包含隐藏的

    -s 只产生一个统计信息

    -k kB为单位

    -h 易读方式

    -L 不计算符号连接

    -M 以M 为单位。

    详细参考

    -a,——all

    write counts for all files, not just directories

    ——apparent-size

    print apparent sizes, rather than disk usage ; although the apparentsize is usually smaller , it may be

    larger due to holes in(a ??sparsea ??) files, internal fragmentation,indirect blocks , and the like

    -B,——block-size=SIZE use SIZE-byte blocks

    -b,——bytes

    equivalent to a ??——apparent-size ——block-size=1a ??

    -c,——total

    produce a grand total

    -D,——dereference-args

    dereference FILEs that are symbolic links

    -H like ——si, but also evokes a warning; will soon change to beequivalent to ——dereference-args(-D)

    -h,——human-readable

    print sizes in human readable format(e.g., 1K 234M 2G )

    ——si like -h, but use powers of 1000 not 1024

    -k like ——block-size=1K

    -l,——count-links

    count sizes many times if hard linked

    -L,——dereference

    dereference all symbolic links

    -P,——no-dereference

    dona??t follow any symbolic links (this is the default )

    -0,——null

    end each output line with 0 byte rather than newline

    -S,——separate-dirs

    do not include size of subdirectories

    -s,——summarize

    display only a total for each argument

    -x,——one-file-system

    skip directories on different filesystems

    -X FILE ,——exclude-from=FILE

    Exclude files that match any pattern in FILE.

    ——exclude=PATTERN Exclude files that match PATTERN.

    ——max-depth=N

    print the total for a directory (or file , with ——all ) onlyif it is N or fewer levels below the command line

    argument;——max-depth=0 is the same as——summarize

    ——help display this help and exit

    ——version

    output version information and exit

    ls?lh可以看出当前目录文件的大小(不含目录),比如下面的的322M.

    [root@LS-SVR-18 ~]# ls -lh

    total 322M

    -rw-r ——r —— 1 root root 312M Aug 1 23:35 10.50.86.18.tar.z

    -rw-r ——r —— 1 root root 1.3K Aug 1 17:41 anaconda-ks.cfg

    drwxr-xr-x 2 root root 4.0K Aug 1 21:44 Desktop

    -rw-r ——r —— 1 root root 62K Aug 1 17 :41 install.log

    -rw-r ——r —— 1 root root 5.2K Aug 1 17:41 install.log.syslog

    -rw-r ——r —— 1 root root 8.9M Sep 28 15 :29 Install_MSN_Messenger_zhcn.EXE

    -rwxr-xr-x 1 root root 9.2K Aug 16 11 :20 m64

    -rw-r ——r —— 1 root root 1.1K Aug 16 11 :20 m64.c

    -rw-r ——r —— 1 root root 1.1K Aug 8 04:33 m64.o

    drwxr-xr-x 2 root root 4.0K Oct 9 15:45 MCA

    drwxr-xr-x 2 root root 4.0K Oct 9 15:41 MGM

    drwxr-xr-x 2 root root 4.0K Oct 9 15:45 MYSQL

    -rw —— 1 root root 95 Sep 5 10:34 nohup.out

    使用du -sSh 也是同样的结果

    [root@LS-SVR-18 ~]# du -sSh

    322M

    使用du -sh则包含了子目录的内容

    [root@LS-SVR-18 ~]# du -sh

    451M .

    查看每个文件和目录的大小

    [root@LS-SVR-18 ~]# du -sh *

    313M 10.50.86.18.tar.z

    8.0K anaconda-ks.cfg

    8.0K Desktop

    72K install.log

    12K install.log.syslog

    8.9M Install_MSN_Messenger_zhcn.EXE

    16K m64

    8.0K m64.c

    8.0K m64.o

    476K MCA

    65M MGM

    65M MYSQL

    8.0K nohup.out


推荐阅读
  • 本文介绍了Redis的基础数据结构string的应用场景,并以面试的形式进行问答讲解,帮助读者更好地理解和应用Redis。同时,描述了一位面试者的心理状态和面试官的行为。 ... [详细]
  • Java学习笔记之使用反射+泛型构建通用DAO
    本文介绍了使用反射和泛型构建通用DAO的方法,通过减少代码冗余度来提高开发效率。通过示例说明了如何使用反射和泛型来实现对不同表的相同操作,从而避免重复编写相似的代码。该方法可以在Java学习中起到较大的帮助作用。 ... [详细]
  • SpringBoot整合SpringSecurity+JWT实现单点登录
    SpringBoot整合SpringSecurity+JWT实现单点登录,Go语言社区,Golang程序员人脉社 ... [详细]
  • LVS实现负载均衡的原理LVS负载均衡负载均衡集群是LoadBalance集群。是一种将网络上的访问流量分布于各个节点,以降低服务器压力,更好的向客户端 ... [详细]
  • 本文详细介绍了在Centos7上部署安装zabbix5.0的步骤和注意事项,包括准备工作、获取所需的yum源、关闭防火墙和SELINUX等。提供了一步一步的操作指南,帮助读者顺利完成安装过程。 ... [详细]
  • GSIOpenSSH PAM_USER 安全绕过漏洞
    漏洞名称:GSI-OpenSSHPAM_USER安全绕过漏洞CNNVD编号:CNNVD-201304-097发布时间:2013-04-09 ... [详细]
  • 本文介绍了在RHEL 7中的系统日志管理和网络管理。系统日志管理包括rsyslog和systemd-journal两种日志服务,分别介绍了它们的特点、配置文件和日志查询方式。网络管理主要介绍了使用nmcli命令查看和配置网络接口的方法,包括查看网卡信息、添加、修改和删除配置文件等操作。 ... [详细]
  • Python脚本编写创建输出数据库并添加模型和场数据的方法
    本文介绍了使用Python脚本编写创建输出数据库并添加模型数据和场数据的方法。首先导入相应模块,然后创建输出数据库并添加材料属性、截面、部件实例、分析步和帧、节点和单元等对象。接着向输出数据库中添加场数据和历程数据,本例中只添加了节点位移。最后保存数据库文件并关闭文件。文章还提供了部分代码和Abaqus操作步骤。另外,作者还建立了关于Abaqus的学习交流群,欢迎加入并提问。 ... [详细]
  •     这里使用自己编译的hadoop-2.7.0版本部署在windows上,记得几年前,部署hadoop需要借助于cygwin,还需要开启ssh服务,最近发现,原来不需要借助cy ... [详细]
  • 大坑|左上角_pycharm连接服务器同步写代码(图文详细过程)
    篇首语:本文由编程笔记#小编为大家整理,主要介绍了pycharm连接服务器同步写代码(图文详细过程)相关的知识,希望对你有一定的参考价值。pycharm连接服务 ... [详细]
  • Hadoop2.6.0 + 云centos +伪分布式只谈部署
    3.0.3玩不好,现将2.6.0tar.gz上传到usr,chmod-Rhadoop:hadophadoop-2.6.0,rm掉3.0.32.在etcp ... [详细]
  • linux 禁止指定ip访问
    linux中如何禁止指定的ip访问呢?比如被别人暴力破解,被别人使用不同的密码尝试登录:所以我想直接禁用这些ip的访问.怎么办呢?解决方案:修改配置文件etchosts.deny把 ... [详细]
  • 一、修改注册表去掉桌面图标小箭头1按下win+R组合快捷键,打开windows10系统的“运行”窗口,输入“regedit”,打开注册表编辑器,找到HKEY_CLASSES_ROOT\lnkfi ... [详细]
  • Django + Ansible 主机管理(有源码)
    本文给大家介绍如何利用DjangoAnsible进行Web项目管理。Django介绍一个可以使Web开发工作愉快并且高效的Web开发框架,能够以最小的代价构建和维护高 ... [详细]
  • hadoop1.2.1文档中这样写:Nowcheckthatyoucansshtothelocalhostwithoutapassphrase:$sshlocalhostIfyou ... [详细]
author-avatar
史祥旋_247
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有