Android adb shell中执行
df 查看文件系统的磁盘空间占用情况 df 或者 df -h 或者 df -H
其中 -h Human readable output (K=1024) -H Human readable output (k=1000)
generic_x86_64:/system # df -H
Filesystem Size Used Avail Use% Mounted on
/dev/root 2.6G 1.3G 1.2G 53% /
tmpfs 784M 479k 783M 1% /dev
tmpfs 784M 0 784M 0% /mnt
/dev/block/vde1 97M 63M 33M 66% /vendor
/dev/block/dm-0 813M 89M 723M 11% /data
/data/media 813M 89M 723M 11% /mnt/runtime/default/emulated
/dev/block/vold/public:253,80 535M 4.0k 535M 1% /mnt/media_rw/08EE-3E1A
/mnt/media_rw/08EE-3E1A 535M 4.0k 535M 1% /mnt/runtime/default/08EE-3E1A
generic_x86_64:/system # df -h
Filesystem Size Used Avail Use% Mounted on
/dev/root 2.4G 1.2G 1.1G 53% /
tmpfs 747M 468K 747M 1% /dev
tmpfs 747M 0 747M 0% /mnt
/dev/block/vde1 92M 60M 32M 66% /vendor
/dev/block/dm-0 775M 85M 690M 11% /data
/data/media 775M 85M 690M 11% /mnt/runtime/default/emulated
/dev/block/vold/public:253,80 510M 4.0K 510M 1% /mnt/media_rw/08EE-3E1A
/mnt/media_rw/08EE-3E1A 510M 4.0K 510M 1% /mnt/runtime/default/08EE-3E1A
generic_x86_64:/system # df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/root 2580272 1362108 1218164 53% /
tmpfs 765348 468 764880 1% /dev
tmpfs 765348 0 765348 0% /mnt
/dev/block/vde1 94588 61940 32648 66% /vendor
/dev/block/dm-0 793488 87092 706396 11% /data
/data/media 793488 87092 706396 11% /mnt/runtime/default/emulated
/dev/block/vold/public:253,80 522228 4 522224 1% /mnt/media_rw/08EE-3E1A
/mnt/media_rw/08EE-3E1A 522228 4 522224 1% /mnt/runtime/default/08EE-3E1A
查看当前文件夹大小 du -sh or du -s
1|generic_x86_64:/system # du -sh
1.2G .
generic_x86_64:/system # du -s
1354028 .
查看当前文件夹下根目录文件、文件夹大小 du -h -d 1
generic_x86_64:/system # du -h -d 1
10M ./xbin
12K ./fake-libs64
238M ./app
4.9M ./etc
12K ./fake-libs
258M ./priv-app
11M ./media
29M ./bin
25M ./usr
211M ./lib
8.0K ./product
238M ./lib64
229M ./framework
68M ./fonts
1.2G .
help 提示
# df --help
usage: df [-HPkhi] [-t type] [FILESYSTEM ...]
The "disk free" command shows total/used/available disk space for
each filesystem listed on the command line, or all currently mounted
filesystems.
-a Show all (including /proc and friends)
-P The SUSv3 "Pedantic" option
-k Sets units back to 1024 bytes (the default without -P)
-h Human readable output (K=1024)
-H Human readable output (k=1000)
-i Show inodes instead of blocks
-t type Display only filesystems of this type
# du --help
usage: du [-d N] [-askxHLlmc] [file...]
Show disk usage, space consumed by files and directories.
Size in:
-k 1024 byte blocks (default)
-K 512 byte blocks (posix)
-m megabytes
-h human readable format (e.g., 1K 243M 2G )
What to show:
-a all files, not just directories
-H follow symlinks on cmdline
-L follow all symlinks
-s only total size of each argument
-x don't leave this filesystem
-c cumulative total
-d N only depth < N
-l disable hardlink filter