linux的文件命令
2015-12-24 00:00
567 查看
摘要: 简述linux的文件系统命令:df(整个文件系统和磁盘的情况),du(单文件或者文件夹的磁盘),fdisk(磁盘管理)
一.常用命令
df:整个文件系统和磁盘情况)
du:单文件或者文件夹的磁盘块)
fdisk:磁盘的分区管理)
stat: 显示文件、文件夹的信息
1.1显示磁盘分区: df
1.2 显示磁盘的inode :
1.3显示磁盘的使用类型:
三.Fdisk
3.1简介:给磁盘分区.<一般不常用>
3.2 使用:
第一步:fdisk 磁盘名(fdisk /dev/sda)
选择打印:p
类型表:l
Linux文件
一.常用命令
df:整个文件系统和磁盘情况)du:单文件或者文件夹的磁盘块)
fdisk:磁盘的分区管理)
stat: 显示文件、文件夹的信息
一.df:
1.0:简介: 命令可以获取硬盘被占用了多少空。这个是获取整个文件系统和磁盘的情况-a:显示所有文件系统的磁盘使用情况,包括0块(block)的文件系统,如/proc文件系统。 -k:以k字节为单位显示。 -i:显示i节点信息,而不是磁盘块。 -t:显示各指定类型的文件系统的磁盘空间使用情况。 -x:列出不是某一指定类型文件系统的磁盘空间使用情况(与t选项相反)。 -T:显示文件系统类型。
1.1显示磁盘分区: df
$ 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 :
$ 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显示磁盘的使用类型:
$ 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
二.Du
2.1简介: du:(Disk usage )磁盘的使用情况。统计文件/文件夹 占磁盘空间的大小-s:对每个Names参数只给出占用的数据块总数。 -a:递归地显示指定目录中各文件及子目录中各文件占用的数据块数。若既不指定-s,也不指定-a,则只显示Names中的每一个目录及其中的各子目录所占的磁盘块数。 -b:以字节为单位列出磁盘空间使用情况(系统默认以k字节为单位)。 -k:以1024字节为单位列出磁盘空间使用情况。 <k、b 在这种统计命令中一般用来表示:byte或者k> -c:最后再加上一个总计(系统默认设置)。 -l:计算所有的文件大小,对硬链接文件,则计算多次。 -x:跳过在不同文件系统上的目录不予统计。
三.Fdisk
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
四.stat
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: -
相关文章推荐
- Linux socket 初步
- linux lsof详解
- linux 文件权限
- Linux 执行数学运算
- 10 篇对初学者和专家都有用的 Linux 命令教程
- Linux 与 Windows 对UNICODE 的处理方式
- Ubuntu12.04下QQ完美走起啊!走起啊!有木有啊!
- 解決Linux下Android开发真机调试设备不被识别问题
- 运维入门
- 运维提升
- Linux 自检和 SystemTap
- Ubuntu Linux使用体验
- c语言实现hashmap(转载)
- Linux 信号signal处理机制
- linux下mysql添加用户
- Scientific Linux 5.5 图形安装教程
- 基于 Linux 集群环境上 GPFS 的问题诊断
- 谁是桌面王者?Win PK Linux三大镇山之宝
- vivi下重新调整分区