Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
list all installed packages in android adb shell
pm list packages -f


Nice one liner: " adb shell 'pm list packages -f' "

banshee commented May 1, 2014

And for just the packages:

adb shell 'pm list packages -f' | sed -e 's/.*=//' | sort

Need to delete a bunch of things? This gives you an uninstall for everything that's installed; cut and paste to adjust:

adb shell 'pm list packages -f' | sed -e 's/.*=//' | sed -e 's/^/adb uninstall /' | sort | less

how to save it as a notepad text file?
I found the answer:
adb shell pm list packages -f > b:\1.txt

amr commented Sep 13, 2014

Building up on banshee's one liner, for me there was a trailing \r, removing it was needed, as such:

adb shell 'pm list packages -f' | sed -e 's/.*=//' | sed 's/\r//g' | sort

Only then I was able to do get the following to work:

adb shell 'pm list packages -f' | sed -e 's/.*=//' | sed 's/\r//g' | grep "com.foobar" | while read pkg; do adb uninstall $pkg; done;


rmk677 commented May 20, 2015

a simple : adb shell 'pm list packages' | sed -n "s/^packages://p"
wont be enought ? I'm a bit lazy...

rmk677 commented May 22, 2015

ok, i saw ...
the \r at the end and weird "$" at the beginning...

sn0w commented Jun 22, 2015

Thanks OP, helped me

cusspvz commented Jul 1, 2015

Thanks!!! :)
adb shell "pm list packages -f" | cut -f 2 -d "="

ChiChou commented Aug 4, 2015

@cusspvz -f is unnecessary. adb shell "pm list packages"|cut -f 2 -d ":" works.

Thanks for sharing! 👍

rdfewxf commented Apr 23, 2016

I also have one: adb shell pm list packages | awk -F ":" '{print $2}'
@ChiChou is right -f is unnecessary.


could you please let me know how to uninstall a bunch of similar packages in android...
example- i have many application installed in our device with package name So how to uninstall that app which start with packages..


Iryna- commented May 17, 2016

Thanks guys!

gitfib commented May 26, 2016

with google play links, no matter the app installer:

all third-party apps (slow because of pm)

adb shell "echo $'<!DOCTYPE html><html><head><title>My Apps</title></head><body>'; pm list packages -3 | sed -e 's/-.*//' | sed -e 's/.*://' | sort | while read -r line; do echo $'<a href="'$line$'" target="_blank">'$line$'</a><br/>'; done; echo $'</body></html>'" > ./myapps.html

external apps only (at least on marshmallow), assuming only one expandable device, and might include duplicates

adb shell "echo $'<!DOCTYPE html><html><head><title>My Apps</title></head><body>'; ls /mnt/expand/$(ls /mnt/expand/ | head)/app | sed -e 's/-.*//' | sed -e 's/.*://' | sort | while read -r line; do echo $'<a href="'$line$'" target="_blank">'$line$'</a><br/>'; done; echo $'</body></html>'" > ./myapps.html

@davidnunez This is a useful command for modifying older phones, especially when needing to make space by uninstalling packages. @changetip $1

PN1019 commented Dec 13, 2016

When I'm trying to copy link directly:
$ adb push ./lib/ /lib

all work fine, but the file a link points to got copied, not a link itself (target now has /lib/ file instead link to file).
Is it possible to copy links to target via adb at all ?J


Thanks. Worked great.

There's no longer any pm list option

Anubioz commented Jun 19, 2017

It's now
adb shell sh -c 'cmd package list packages -f'


zweite commented Jul 20, 2017


No longer seems to work on oreo.


well good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment