- 🐚作者简介:花神庙码农(专注于Linux、WLAN、TCP/IP、Python等技术方向)
- 🐳博客主页:花神庙码农 ,地址:https://blog.csdn.net/qxhgd
- 🌐系列专栏:Linux技术
- 📰如觉得博主文章写的不错或对你有所帮助的话,还望大家三连支持一下呀!!! 👉关注✨、点赞👍、收藏📂、评论。
- 如需转载请参考转载须知!!
本系列文章,整理了一些获取磁盘空间相关信息的一些方式,如命令行方式、GUI方式等,本文是第一篇,关注命令行方式。
[qxhgd@localhost]$ ls -al
total 1110824
drwxrwxr-x 2 qxhgd qxhgd 31 Feb 2 2022 .
drwxrw----+ 25 qxhgd qxhgd 4096 Nov 23 06:11 ..
-rwxr--r-- 1 qxhgd qxhgd 1137479680 Jan 27 2022 linux-5.15.17.tar
[qxhgd@localhost]$df
Filesystem 1K-blocks Used Available Use% Mounted on
devtmpfs 914448 0 914448 0% /dev
tmpfs 931536 0 931536 0% /dev/shm
tmpfs 931536 10472 921064 2% /run
tmpfs 931536 0 931536 0% /sys/fs/cgroup
/dev/mapper/rhel-root 17811456 7170896 10640560 41% /
/dev/sda1 1038336 186396 851940 18% /boot
tmpfs 186308 0 186308 0% /run/user/1000
tmpfs 186308 12 186296 1% /run/user/42
[qxhgd@localhost code_back]$ du -ah --max-depth=1
1.1G ./linux-5.15.17.tar
1.1G .
[qxhgd@localhost linux-5.15.17]$ du -ah --max-depth=1 | sort -hr
1.2G .
760M ./drivers
134M ./arch
56M ./Documentation
48M ./include
45M ./tools
45M ./fs
43M ./sound
35M ./net
12M ./kernel
[qxhgd@localhost code_back]$ stat linux-5.15.17.tar
File: ‘linux-5.15.17.tar’
Size: 1137479680 Blocks: 2221640 IO Block: 4096 regular file
Device: fd00h/64768d Inode: 52633409 Links: 1
Access: (0744/-rwxr--r--) Uid: ( 1000/ qxhgd) Gid: ( 1000/ qxhgd)
Access: 2022-05-02 01:52:10.499986450 +0800
Modify: 2022-01-27 22:27:42.280325600 +0800
Change: 2022-02-02 06:17:20.924206555 +0800
Birth: -
[qxhgd@localhost code_back]$ sudo fdisk -l
[sudo] password for qxhgd:
Disk /dev/sda: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x0000789d
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 2099199 1048576 83 Linux
/dev/sda2 2099200 41943039 19921920 8e Linux LVM
Disk /dev/mapper/rhel-root: 18.2 GB, 18249416704 bytes, 35643392 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/rhel-swap: 2147 MB, 2147483648 bytes, 4194304 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
[root@localhost]$# quota -vu qxhgd
Disk quotas for user qxhgd(uid 502):
Filesystem blocks quota limit grace files quota limit grace
/dev/hdb1 0 45000 50000 0 0 0
[qxhgd@localhost]$ lsblk
NAME MAJ:MIN rm SIZE RO type mountpoint
sda 8:0 0 232.9G 0 disk
├─sda1 8:1 0 46.6G 0 part /
├─sda2 8:2 0 1K 0 part
├─sda5 8:5 0 190M 0 part /boot
├─sda6 8:6 0 3.7G 0 part [SWAP]
├─sda7 8:7 0 93.1G 0 part /data
└─sda8 8:8 0 89.2G 0 part /personal
sr0 11:0 1 1024M 0 rom
qxhgd@debian:~$ sudo blockdev --report
RO RA SSZ BSZ StartSec Size Device
rw 256 512 4096 0 21474836480 /dev/sda
rw 256 512 4096 2048 20449329152 /dev/sda1
rw 256 512 1024 39944190 1024 /dev/sda2
rw 256 512 4096 39944192 1022361600 /dev/sda5
rw 256 512 512 0 1073741312 /dev/sr0
如本文对你有些许帮助,欢迎大佬加关注、评论、点赞,有关必回关