Obtaining app storage details via ADB
10
votes
3
answers
11843
views
**TL;DR:**
On-device, we can navigate to *Settings › Apps,* and for each app separately can call up details on storage used: by the app itself, by its data, by its cache. Is it possible to obtain those details from the command line, ideally via ADB – and ***without having root access?***
**In detail:**
I've already searched the web, but found no information on this. I've already tried walking the package list (
pm list packages
), obtaining the path to the APK file (adb shell pm path $pkgname | awk -F':' '{print $2}'
), and getting the file size of that (adb shell stat $path | grep Size
) – but that has a series of disadvantages:
* it only gives me the size of the APK (for updated system apps, only of the latest update)
* even if scripted, it takes ~2s per app to obtain even that. As today's devices already ship with far more than 100 system apps, it would take "ages" even if only a few user apps were installed (almost 6 minutes on an almost virgin Wiko Sunny 3 where I just tried that)
* details on data and cache are completely missing
Ideally, Android has already somewhere collected those details; it doesn't take that long via the GUI. Maybe there's some database one could query ***without having root privileges*** – or some XML to parse, or some shell command I missed?
**PS:** if you know about a root-only solution, that'd be "better than nothing". Please indicate that in a comment then so I can come back and ask you to make that an answer if there are no non-root solutions.
Asked by Izzy
(91696 rep)
Jan 18, 2020, 05:45 PM
Last activity: Aug 27, 2025, 03:15 AM
Last activity: Aug 27, 2025, 03:15 AM