I'm running Android 13 in a rooted environment, and I want to use pm or some other Android command-line utility to clear an app's cache. If I do pm clear package.name, it clears the app's data, and that's not what I want ... I only want cache clearing with the app's data remaining intact.

This needs to be a command-line utility, because I want to run it within a Tasker task. It could also be a shell script that runs multiple CLI commands.

I know that I can do pm trim-caches [... args ...] to clear all caches of all apps, but that's not what I want, either. I want to clear the cache of one and only one app at a time.

Thank you in advance for any suggestions.


1 Answer 1


OOPS! I originally overlooked the answer when checking the pm help text.

All I have to do is pm clear --cache-only package.name.

  • this command is not work, it will still clear UserData.
    – lotosbin
    Jan 5 at 8:12
  • This command only clears the cache on my Android 13 device, and UserData is left intact.
    – HippoMan
    Mar 1 at 0:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .