How can I use adb to uninstall all 3rd party user apps?

荒凉一梦 提交于 2019-11-30 10:15:00

Try:

adb shell pm list packages -3 | cut -d':' -f2 | tr '\r' ' ' | xargs -r -n1 -t adb uninstall
  • First part is to get 3rd party app package names
  • second part is to split package names using delimiter :
  • third part is to replace carriage return with space (sometimes it would be a problem in linux machines. Try removing this part and check if you face it)
  • and the last one is for uninstalling one by one
    • r option will prevent xargs from running the command if there are no third party apps installed
    • n1 option is to pass one result value as argument at a time to the command
    • t is for printing the command being executed)

Hope it helps!!!

What seems to be the problem? It can be done with this one-liner:

adb shell "pm list packages -3 | cut -c9- | xargs pm uninstall"
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!