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

4

32

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.

Pyre answered 8/4, 2014 at 20:39 Comment(2)
How do you get the results in KB? My df command returns GB which is not granular enoughCassandra
@JoshGraham use df -h for human readable.Vacate
S
35

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

Shawn answered 8/4, 2014 at 20:51 Comment(3)
Thanks df command works!! I tried on Samsung SIII, Note, Nexus 5, SIV and it worked. To get the free space for sdcard, I used this command: adb shell df /dataPyre
If you don't have the df command in the shell try to run it from within busybox: adb shell busybox df -h | grep '^/dev/fuse' . If you don't have busybox, install it :-)Overscrupulous
I'm getting busybox, since df options (like -h) aren't working.Justify
S
30
  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

  7. Only for the root level folders

    adb shell du -x -sh /*

Submariner answered 13/10, 2016 at 7:50 Comment(0)
U
2

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

du -a <the_dir> | sort -n -r | head -n 20
Unfold answered 31/3, 2019 at 21:28 Comment(0)
P
0

du | sort -n -r will mess up the hierarchy of folders, so I prefer -t, --threshold=SIZE to set a threshold.

But du on my Android phone doesn't have -t, --threshold=SIZE option

So I found an alternative:

du -m | awk '$1 >= 100'

(Display directories with a size >= 100MB)

Pentimento answered 22/11, 2022 at 2:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.