linux 如何查看分区

linux 如何查看分区,第1张

1、首先登录linux服务。

2、有几种方法可以查看,我们使用第一种方法,命令“df”。

3、命令“df -lh”使用此命令使磁盘使用更加清晰。

4、命令“df -a”是所有文件系统的用法。

5、命令“df -i”显示inode信息。

6、命令“df -k”具有显示块占用率的字节数。

使用命令 df
user@linux-i1aa:~> df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 28G 43G 23G 16% /
devtmpfs 992M 0 992M 0% /dev
tmpfs 1000M 80K 1000M 1% /dev/shm
tmpfs 1000M 98M 902M 10% /run
tmpfs 1000M 0 1000M 0% /sys/fs/cgroup
/dev/sda2 28G 43G 23G 16% /snapshots

[root@minimal boot]# pwd/boot[root@minimal boot]# ls / |xargs du -shdu: cannot access `bin': No such file or directorydu: cannot access `boot': No such file or directorydu: cannot access `cgroup': No such file or directorydu: cannot access `dev': No such file or directorydu: cannot access `etc': No such file or directorydu: cannot access `home': No such file or directorydu: cannot access `lib': No such file or directory13K lost+founddu: cannot access `media': No such file or directorydu: cannot access `mnt': No such file or directorydu: cannot access `opt': No such file or directorydu: cannot access `proc': No such file or directorydu: cannot access `root': No such file or directorydu: cannot access `sbin': No such file or directorydu: cannot access `selinux': No such file or directorydu: cannot access `srv': No such file or directorydu: cannot access `sys': No such file or directorydu: cannot access `tmp': No such file or directorydu: cannot access `usr': No such file or directorydu: cannot access `var': No such file or directory[root@minimal boot]# cd /[root@minimal /]# ls |xargs du -sh59M bin28M boot40K cgroup480K dev31M etc20K home100M lib16K lost+found102M media64M mnt28G optdu: cannot access `proc/2533/task/2533/fd/4': No such file or directorydu: cannot access `proc/2533/task/2533/fdinfo/4': No such file or directorydu: cannot access `proc/2533/fd/4': No such file or directorydu: cannot access `proc/2533/fdinfo/4': No such file or directory0 proc139M root92M sbin0 selinux40K srv0 sys380K tmp26G usr116M varls与xargs配合使用时,ls只能显示当前的目录,所以要想显示根目录下的文件的大小,必须在根目录下配合使用ls与xargs命令 [root@minimal /]# ls |grep -v proc |xargs du -sh |sort -h0 selinux0 sys40K cgroup40K srv16K lost+found20K home380K tmp492K dev59M bin92M sbin28M boot31M etc64M mnt100M lib102M media116M var152M root26G usr28G opt按大小和单一模式显示除proc目录以外的所有根目录下的文件 /proc 这个目录本身是一个『虚拟档案系统』!它放置的数据都是在内存当中, 例如系统核心、形成信息、接口设备的状态及网络状态等等。因为这个目录下的数据都是在内存当中, 所以本身不占任何硬盘空间! [root@RedHat /]# ls -A |grep -v proc |xargs du -sh |sort -h0 autofsck0 misc0 net0 selinux0 sys40K cgroup40K media40K srv12K dbus16K lost+found28K mnt28K tmp712K dev73M root74M bin13M sbin19M boot33M etc102M lib177M var323M home29G opt36G usrls -A显示所有文件但不包括""和"";即当前目录和当前目录的父目录。[root@RedHat /]# ls -a |grep -v proc |xargs du -sh |sort -hdu: cannot access `/proc/9394/task/9394/fd/4': No such file or directorydu: cannot access `/proc/9394/task/9394/fdinfo/4': No such file or directorydu: cannot access `/proc/9394/fd/4': No such file or directorydu: cannot access `/proc/9394/fdinfo/4': No such file or directorydu: cannot access `/proc/9394/task/9394/fd/4': No such file or directorydu: cannot access `/proc/9394/task/9394/fdinfo/4': No such file or directorydu: cannot access `/proc/9394/fd/4': No such file or directorydu: cannot access `/proc/9394/fdinfo/4': No such file or directory0 autofsck0 misc0 net0 selinux0 sys40K cgroup40K media40K srv12K dbus16K lost+found28K mnt28K tmp712K dev73M root74M bin13M sbin19M boot33M etc102M lib177M var323M home29G opt36G usr71G 71G |grep -v proc 不显示proc目录du -sh 以单一模式显示文件或目录的大小|sort -h 按从小到大的顺序显示文件列表 注:通过上例发现管道太牛逼了,有空要好好研究一下。

查看boot分区大小,可以在终端执行以下命令:
df
-h
/boot
解释:df命令就是显示文件系统的磁盘使用量的,-h参数表示以GB、MB、KB的格式显示容量,后面跟的/boot表示列出/boot这个挂载点所在的文件系统的容量信息。


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/yw/10251756.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-06
下一篇 2023-05-06

发表评论

登录后才能评论

评论列表(0条)

保存