如何使用 adb 命令在 android 中获取可用/免费 sdcard 空间

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22947690/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 06:35:40  来源:igfitidea点击:

How to get available/free sdcard space in android with adb command

androidadbdiskspace

提问by Venkatesh

I am trying to get free sdcard space with adb command, but I could not able to achieve. Any suggestions how to get the sdcard space.

我正在尝试使用 adb 命令获得可用的 sdcard 空间,但我无法实现。任何关于如何获得 SD 卡空间的建议。

回答by CommonsWare

Use df, as with any Linux distro. Not all Android devices may have it, but it usually seems to be available.

使用df,与任何Linux发行版。并非所有 Android 设备都可能拥有它,但它通常似乎可用。

回答by Lava Sangeetham

  1. df: Disk space details.

    adb shell df

  2. du: Disk space used by the specified files and subdirectories.

    adb shell du

  3. df -h: Disk space details in KB/MB format.

    adb shell df -h

  4. du -h: Disk space used by the specified files and subdirectories in KB/MB format.

    adb shell du -h

  5. For specific folder desk space details.

    adb shell df /system

  6. For specific folder and sub-directories desk space details

    adb shell du /system

  1. df:磁盘空间详细信息。

    亚行外壳 df

  2. du:指定文件和子目录使用的磁盘空间。

    adb shell du

  3. df -h:KB/MB 格式的磁盘空间详细信息。

    adb shell df -h

  4. du -h: KB/MB 格式的指定文件和子目录使用的磁盘空间。

    adb shell du -h

  5. 有关特定文件夹桌面空间的详细信息。

    adb shell df /system

  6. 有关特定文件夹和子目录桌面空间的详细信息

    adb shell du /system

回答by cieunteung

df -hto find disk usage and to find big files:

df -h查找磁盘使用情况并查找大文件:

du -a <the_dir> | sort -n -r | head -n 20