📅  最后修改于: 2023-12-03 15:29:17.606000             🧑  作者: Mango
If you're an Android developer, you're probably already familiar with ADB (Android Debug Bridge). ADB is a command-line tool that lets you communicate with any Android device. One of the key features of ADB is the ability to list packages installed on an Android device. This is where the adb shell list packages
command comes in.
adb shell list packages
?The adb shell list packages
command lists all the packages (i.e., apps) that are installed on your Android device. By default, it will display all the packages, but you can also use filters to narrow down the results. For example, you can use the -3
filter to show only the third-party packages installed on your device, or the -s
filter to show only the system packages.
Here's the basic syntax of the adb shell list packages
command:
adb shell list packages [options] [FILTER]
Let's take a closer look at each part of this command.
adb shell
: This tells ADB to run a command in the shell of your Android device.list packages
: This is the actual command that tells ADB to list all the packages.[options]
: These are optional parameters that you can use to modify the behavior of the command. We'll cover some of the most useful options later in this post.[FILTER]
: This is an optional filter that allows you to narrow down the results. For example, you can use this to show only packages that contain a specific keyword.adb shell list packages
Using adb shell list packages
is very easy. First, connect your Android device to your computer via USB and make sure that ADB is set up correctly. Then, open a terminal or command prompt and run the following command:
adb shell list packages
This will display a list of all the packages installed on your device. Depending on the number of apps you have installed, this list can be quite long.
If you want to narrow down the results, you can use filters. For example, to show only the third-party packages, run the following command:
adb shell list packages -3
This will display a list of all the third-party packages installed on your device.
You can use different filters to refine the results further. Here are some of the most useful options:
-3
: Show only third-party packages-s
: Show only system packages-e
: Show only the enabled packages-d
: Show only the disabled packages-u
: Show only the packages that are installed but not currently in useFor example, to show only the enabled third-party packages, run the following command:
adb shell list packages -3 -e
This will display a list of all the enabled third-party packages installed on your device.
The adb shell list packages
command is a handy tool for any Android developer or power user. It allows you to quickly list all the packages installed on your device, or narrow down the results using filters. With this command, you can easily find the package name of any app installed on your device, which is useful when working with ADB or other Android development tools.