Instantly share code, notes, and snippets.

Embed
What would you like to do?
list all installed packages in android adb shell
pm list packages -f
@full-of-foo

This comment has been minimized.

full-of-foo commented Nov 15, 2013

👍

@full-of-foo

This comment has been minimized.

full-of-foo commented Nov 15, 2013

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

@banshee

This comment has been minimized.

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

@sunnychan2012

This comment has been minimized.

sunnychan2012 commented Jul 31, 2014

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

@amr

This comment has been minimized.

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;

@zebulon988

This comment has been minimized.

zebulon988 commented Jan 6, 2015

nice

@rmk677

This comment has been minimized.

rmk677 commented May 20, 2015

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

@rmk677

This comment has been minimized.

rmk677 commented May 22, 2015

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

@sn0w

This comment has been minimized.

sn0w commented Jun 22, 2015

Thanks OP, helped me

@cusspvz

This comment has been minimized.

cusspvz commented Jul 1, 2015

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

@ChiChou

This comment has been minimized.

ChiChou commented Aug 4, 2015

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

@alexlopes

This comment has been minimized.

alexlopes commented Mar 11, 2016

Thanks for sharing! 👍

@rdfewxf

This comment has been minimized.

rdfewxf commented Apr 23, 2016

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

@abbath0767

This comment has been minimized.

abbath0767 commented Apr 27, 2016

nice

@krishna18787

This comment has been minimized.

krishna18787 commented May 7, 2016

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 com.app.appXXXXX... So how to uninstall that app which start with com.app packages..

Thanks

@Iryna-

This comment has been minimized.

Iryna- commented May 17, 2016

Thanks guys!

@gitfib

This comment has been minimized.

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="https://play.google.com/store/apps/details?id='$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="https://play.google.com/store/apps/details?id='$line$'" target="_blank">'$line$'</a><br/>'; done; echo $'</body></html>'" > ./myapps.html

@IgorGanapolsky

This comment has been minimized.

IgorGanapolsky commented Aug 4, 2016

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

@PN1019

This comment has been minimized.

PN1019 commented Dec 13, 2016

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

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

Thanks!!

@farhanarrafi

This comment has been minimized.

farhanarrafi commented Dec 21, 2016

Thanks. Worked great.

@droidzone

This comment has been minimized.

droidzone commented Apr 12, 2017

There's no longer any pm list option

@Anubioz

This comment has been minimized.

Anubioz commented Jun 19, 2017

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

@rafaelsm

This comment has been minimized.

rafaelsm commented Jul 17, 2017

Thanks!

@zweite

This comment has been minimized.

zweite commented Jul 20, 2017

thk

@mickrussom

This comment has been minimized.

mickrussom commented Sep 5, 2017

No longer seems to work on oreo.

@DillionApple

This comment has been minimized.

DillionApple commented Nov 29, 2017

good

@huangyanxiong01

This comment has been minimized.

huangyanxiong01 commented Jan 16, 2018

well good

@reach2jeyan

This comment has been minimized.

reach2jeyan commented Mar 5, 2018

To list only user installed applications "pm list packages -3"|cut -f 2 -d ":"

@inboxdarpan

This comment has been minimized.

inboxdarpan commented Mar 27, 2018

adb shell "pm list packages -u -3", here adding -u also includes apps that have been uninstalled previously. (Though it doesn't work on few devices)
Source

@semirenko

This comment has been minimized.

semirenko commented Mar 30, 2018

Thanks a lot

@lhuemill

This comment has been minimized.

lhuemill commented Mar 30, 2018

Instead of:

sed 's/\r//g'

or:

cut -f 2 -d ":"

to get rid of the trailing carriage-return and/or newline, I use:

tr -d [:cntrl:]

@antoniocaser

This comment has been minimized.

antoniocaser commented May 8, 2018

I deleted the package, but it still appears on Android as "not installed", it's missing the delete folder, how do I?
Android without root, with adb shell ($) ...

@tmst

This comment has been minimized.

tmst commented Jul 24, 2018

@reach2jeyan Would be nice to see your command, or any of these commands, sort in order of the last singlet(?) in the app name. in other words, by 'gamma' in "com.beta.gamma".

@namespace7

This comment has been minimized.

namespace7 commented Nov 30, 2018

help needed here !
command for installing a package of github into android system via shell.
After trying the command pm install
i get the error..
127|shell@tegranote:/system/bin $ pm install https://github.com/WritingMinds/f>
pkg: https://github.com/WritingMinds/ffmpeg-android.git
Failure [INSTALL_FAILED_I

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