df:整个文件系统和磁盘状况)node
du:单文件或者文件夹的磁盘块)shell
fdisk:磁盘的分区管理)centos
stat: 显示文件、文件夹的信息
app
1.0:简介: 命令能够获取硬盘被占用了多少空。这个是获取整个文件系统和磁盘的状况ui
-a:显示全部文件系统的磁盘使用状况,包括0块(block)的文件系统,如/proc文件系统。 -k:以k字节为单位显示。 -i:显示i节点信息,而不是磁盘块。 -t:显示各指定类型的文件系统的磁盘空间使用状况。 -x:列出不是某一指定类型文件系统的磁盘空间使用状况(与t选项相反)。 -T:显示文件系统类型。
1.1显示磁盘分区: df this
$ df Filesystem 1K-blocks Used Available Use% Mounted on /dev/mapper/centos-root 31441920 4529648 26912272 15% / devtmpfs 925544 0 925544 0% /dev tmpfs 935256 148 935108 1% /dev/shm tmpfs 935256 9068 926188 1% /run tmpfs 935256 0 935256 0% /sys/fs/cgroup /dev/mapper/centos-home 49725724 356928 49368796 1% /home /dev/sda1 508588 126460 382128 25% /boot .host:/ 454928380 47202848 407725532 11% /mnt/hgfs 解释: Filesystem -----》磁盘的分区信息 1K-blocks ----》分区块 Used ------》使用状况 Available ------》剩余状况 Use% -------》使用比例 Mounted on -------》挂载的文件 ( 使用+剩余 不必定等于总块数。为了给系统预留一部分空间,让磁盘满的状况,让管理员进入进行操做)
1.2 显示磁盘的inode :spa
$ df -i (list inode information instead of block usage:显示块对应的inode) Filesystem Inodes IUsed IFree IUse% Mounted on /dev/mapper/centos-root 31457280 138991 31318289 1% / devtmpfs 231386 400 230986 1% /dev tmpfs 233814 8 233806 1% /dev/shm tmpfs 233814 525 233289 1% /run tmpfs 233814 13 233801 1% /sys/fs/cgroup /dev/mapper/centos-home 49750016 4267 49745749 1% /home /dev/sda1 512000 330 511670 1% /boot .host:/ 0 0 0 - /mnt/hgfs 解释: Inodes -------》总共的inode<系统分配的范围> IUsed --------》使用 IFree ------》未使用
1.3显示磁盘的使用类型:code
$ df –T Filesystem Type 1K-blocks Used Available Use% Mounted on /dev/mapper/centos-root xfs 31441920 4529228 26912692 15% / devtmpfs devtmpfs 925544 0 925544 0% /dev tmpfs tmpfs 935256 148 935108 1% /dev/shm tmpfs tmpfs 935256 9064 926192 1% /run tmpfs tmpfs 935256 0 935256 0% /sys/fs/cgroup /dev/mapper/centos-home xfs 49725724 356864 49368860 1% /home /dev/sda1 xfs 508588 126460 382128 25% /boot .host:/ vmhgfs 454928380 47202848 407725532 11% /mnt/hgfs
2.1简介: du:(Disk usage )磁盘的使用状况。统计文件/文件夹 占磁盘空间的大小orm
-s:对每一个Names参数只给出占用的数据块总数。 -a:递归地显示指定目录中各文件及子目录中各文件占用的数据块数。若既不指定-s,也不指定-a,则只显示Names中的每个目录及其中的各子目录所占的磁盘块数。 -b:以字节为单位列出磁盘空间使用状况(系统默认以k字节为单位)。 -k:以1024字节为单位列出磁盘空间使用状况。 <k、b 在这种统计命令中通常用来表示:byte或者k> -c:最后再加上一个总计(系统默认设置)。 -l:计算全部的文件大小,对硬连接文件,则计算屡次。 -x:跳过在不一样文件系统上的目录不予统计。
3.1简介:给磁盘分区.<通常不经常使用>递归
Usage: fdisk [options] <disk> change partition table fdisk [options] -l <disk> list partition table(s) fdisk -s <partition> give partition size(s) in blocks Options: -b <size> sector size (512, 1024, 2048 or 4096) 扇区大小 -c[=<mode>] compatible mode: 'dos' or 'nondos' (default) -h print this help text 帮助 -u[=<unit>] display units: 'cylinders' or 'sectors' (default) -v print program version -C <number> specify the number of cylinders -H <number> specify the number of heads -S <number> specify the number of sectors per track
3.2 使用:
第一步:fdisk 磁盘名(fdisk /dev/sda)
a toggle a bootable flag 切换开机的文件 b edit bsd disklabel 编辑 c toggle the dos compatibility flag d delete a partition 删除分区 g create a new empty GPT partition table G create an IRIX (SGI) partition table l list known partition types 分区类型表<至关于ascii> m print this menu n add a new partition 添加 o create a new empty DOS partition table p print the partition table 打印 q quit without saving changes s create a new empty Sun disklabel t change a partition's system id 改变分区类型、通常用于新的设备 u change display/entry units v verify the partition table w write table to disk and exit x extra functionality (experts only)
选择打印:p
类型表:l
4.1 简介: 显示文件、文件夹的信息
文件夹 $ stat /home File: ‘/home’ Size: 16 Blocks: 0 IO Block: 4096 directory Device: fd02h/64770d Inode: 128 Links: 3 Access: (0755/drwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root) Access: 2015-12-13 11:29:01.142687113 +0800 Modify: 2015-12-10 19:54:40.089728044 +0800 Change: 2015-12-10 19:54:40.089728044 +0800 Birth: - 文件 $ stat VMwareTools-10.0.0-2977863.tar.gz File: ‘VMwareTools-10.0.0-2977863.tar.gz’ Size: 71524872 Blocks: 139704 IO Block: 4096 regular file Device: fd02h/64770d Inode: 175 Links: 1 Access: (0444/-r--r--r--) Uid: ( 1000/ fxl) Gid: ( 1000/ fxl) Access: 2015-12-06 10:47:02.939028461 +0800 Modify: 2015-12-06 10:46:52.035027559 +0800 Change: 2015-12-06 10:46:52.035027559 +0800 Birth: -