Using the pm Command to Manage Android Apps (with examples)
- Android
- November 5, 2023
1. Listing all installed apps
To list all installed apps on an Android device, you can use the following command:
pm list packages
Motivation: This command is useful to get a comprehensive list of all the apps installed on the device. It can help in troubleshooting, identifying unnecessary apps, or checking for specific packages.
Explanation: The list packages
argument is used to list all installed packages on the device. The pm
command stands for “Package Manager,” which is responsible for managing apps on Android devices.
Example Output:
package:com.android.settings
package:com.google.android.youtube
package:com.google.chrome
package:com.instagram.android
...
2. Listing all installed system apps
To list only installed system apps on an Android device, you can use the following command:
pm list packages -s
Motivation: This command is beneficial when you specifically want to view the system apps installed on the device. System apps are pre-installed by the device manufacturer or the operating system and cannot be uninstalled easily.
Explanation: The -s
argument is added to the list packages
to filter and display only the system apps installed on the device.
Example Output:
package:com.android.settings
package:com.google.android.youtube
...
3. Listing all installed 3rd-Party apps
To list only installed third-party apps on an Android device, you can use the following command:
pm list packages -3
Motivation: Sometimes, it’s necessary to differentiate between system apps and third-party apps. Third-party apps are the ones installed by the user from sources other than the official app store or system updates.
Explanation: The -3
argument is added to the list packages
command to filter and display only the third-party apps installed on the device.
Example Output:
package:com.google.chrome
package:com.instagram.android
...
4. Listing apps matching specific keywords
To list installed apps that match specific keywords on an Android device, you can use the following command:
pm list packages keyword1 keyword2 ...
Motivation: This command is useful when you want to search for apps with specific keywords in their package names. It can help narrow down the results and find apps that are related to a specific topic or feature.
Explanation: The keyword1
, keyword2
, and so on, are replaced with the keywords you want to search for in the package names. The command will list only the packages that have these keywords in their names.
Example Output:
package:com.google.android.youtube
...
5. Displaying the path of the APK of a specific app
To display the path of the APK file of a specific app on an Android device, you can use the following command:
pm path app
Motivation: This command is useful when you want to find the exact location of the APK file of a specific app. It can be helpful for further analysis, backup, or manual installation of the app on other devices.
Explanation: The app
in the command should be replaced with the package name of the specific app you want the APK path for. The command will return the path of the APK file.
Example Output:
package:/data/app/com.google.android.youtube-8yL6eSdjv_b9v4Jf43yvrQ==/base.apk
By using the pm
command with different arguments, you can manage and gather information about installed apps on an Android device. These use cases can assist in troubleshooting, identifying specific apps, or performing various tasks related to app management.