Home » Android » command – Difference between pm clear and pm uninstall -k on Android

command – Difference between pm clear and pm uninstall -k on Android

Posted by: admin June 15, 2020 Leave a comment

Questions:

from pm help, I get this:

pm uninstall: removes a package from the system. Options:
    -k: keep the data and cache directories around after package removal.

pm clear: deletes all data associated with a package.

Does this mean that when I do pm uninstall (without -k) it deletes all files which would pm clear delete? Or in other words, when I do specify -k for uninstallation command, it leaves files undeleted. When I do pm clear on that package, the files which will be cleared are exactly these I have left undeleted by -k option?

Is it possible that by doing pm uninstall and after that pm clear, I can even delete some files which have not been deleted by pm uninstall?

How to&Answers:

Your understanding is correct:

  • pm uninstall removes everything
  • pm uninstall -k removes the app,
    leaves the user data intact (to be used if the app is reinstalled)
  • pm clear only removes the user data associated with the package,
    but not the package itself