Complete List of Android CMD Commands: A Guide for Advanced Users
The Android Command Line Interface (CLI) allows advanced users and developers to perform various operations on Android devices using ADB (Android Debug Bridge) commands. These commands allow you to interact directly with your Android device via a terminal or command prompt window on your computer. Whether you’re troubleshooting, managing files, installing apps, or modifying system settings, Android CMD commands provide an efficient way to control your device.
In this article, we will go over some of the most commonly used Android CMD commands and their functionalities. These commands will help you perform a wide range of tasks without needing a graphical user interface (GUI).
1. Setting Up ADB (Android Debug Bridge)
Before using Android CMD commands, you need to install and set up ADB on your computer.
Steps to Install ADB:
-
Enable Developer Options on Android:
- Go to Settings > About Phone.
- Tap Build Number 7 times to unlock Developer Options.
- Go to Settings > Developer Options and enable USB Debugging.
-
Install ADB on Computer:
- Windows: Download Minimal ADB and Fastboot or install Android SDK.
- macOS/Linux: Use a package manager like Homebrew for macOS or APT for Linux to install ADB.
-
Verify the ADB Connection:
- Connect your Android device via USB.
- Open Command Prompt (Windows) or Terminal (macOS/Linux) and type:
adb devices - If ADB is set up correctly, your device will appear in the list.
2. Basic ADB Commands
Here’s a list of basic Android CMD commands that every Android user should know.
1. Check Device Connection
- adb devices
- Lists all connected Android devices. It helps verify that ADB is working properly.
2. Enter ADB Shell
- adb shell
- This command opens a shell on your Android device, allowing you to execute commands directly on the device.
3. Install an APK
- adb install <apk_path>
- Installs an APK file on your Android device.
- Example:
adb install C:\path\to\app.apk
4. Uninstall an App
- adb uninstall <package_name>
- Uninstalls an app from your device by specifying the app's package name.
- Example:
adb uninstall com.example.app
5. Reboot Device
- adb reboot
- Reboots your Android device into the normal operating mode.
6. Reboot into Recovery Mode
- adb reboot recovery
- Reboots the device into recovery mode for system recovery tasks.
7. Reboot into Bootloader
- adb reboot bootloader
- Reboots the device into bootloader mode (useful for flashing custom ROMs, boot images, etc.).
8. Power Off Device
- adb shell reboot -p
- Powers off your Android device.
3. File Management Commands
ADB commands can also help you manage files on your Android device directly from your computer.
1. Push Files to Device
- adb push <local_file_path> <remote_device_path>
- Pushes a file from your computer to your Android device.
- Example:
adb push C:\path\to\file.txt /sdcard/
2. Pull Files from Device
- adb pull <remote_device_path> <local_file_path>
- Pulls a file from your Android device to your computer.
- Example:
adb pull /sdcard/file.txt C:\path\to\destination\
3. List Files on Device
- adb shell ls <directory_path>
- Lists files in the specified directory on the device.
- Example:
adb shell ls /sdcard/
4. Remove a File from Device
- adb shell rm <file_path>
- Deletes a file on your Android device.
- Example:
adb shell rm /sdcard/oldfile.txt
4. Device Information and System Commands
These commands allow you to gather information about your device and perform system operations.
1. Get System Info
- adb shell getprop
- Displays system properties such as the model, brand, Android version, etc.
2. Check Battery Status
- adb shell dumpsys battery
- Provides detailed information about the battery, such as level, status, temperature, and health.
3. Check CPU Usage
- adb shell top
- Shows real-time CPU usage on the Android device.
4. View Logcat Logs
- adb logcat
- Displays log data, which can be useful for debugging apps or identifying errors in system processes.
5. Take a Screenshot
- adb shell screencap -p /sdcard/screenshot.png
- Takes a screenshot of the device and saves it to the /sdcard/ directory.
- adb pull /sdcard/screenshot.png <local_file_path>
- Pulls the screenshot to your local machine for further use.
6. Record Screen
- adb shell screenrecord /sdcard/demo.mp4
- Records the screen of the Android device and saves it as a video file.
- adb pull /sdcard/demo.mp4 <local_file_path>
- Pulls the recorded video file to your computer.
5. Advanced Commands for Rooted Devices
If your device is rooted, you can execute more advanced commands for deep system-level modifications.
1. Mount System as Read/Write
- adb remount
- Remounts the system partition as read-write, allowing changes to system files.
2. Change File Permissions
- adb shell chmod <file_path>
- Changes the file permissions of a specified file.
- Example:
adb shell chmod 755 /system/app/myapp.apk
3. Copy System Files
- adb shell cp <source_path> <destination_path>
- Copies files from one location to another on the device.
- Example:
adb shell cp /system/app/myapp.apk /sdcard/
4. Clear App Data/Cache
- adb shell pm clear <package_name>
- Clears the app's data and cache.
- Example:
adb shell pm clear com.example.app
6. Additional Useful Commands
These additional commands are helpful for specific tasks or troubleshooting.
1. Stop an App
- adb shell am force-stop <package_name>
- Forces the specified app to stop.
- Example:
adb shell am force-stop com.example.app
2. Start an App
- adb shell am start -n <package_name>/<activity_name>
- Starts an app from the command line.
- Example:
adb shell am start -n com.example.app/.MainActivity
3. Enable or Disable an App
- adb shell pm enable <package_name>
- Enables a disabled app.
- adb shell pm disable <package_name>
- Disables an app without uninstalling it.
4. View Network Information
- adb shell ifconfig
- Displays network information, such as IP addresses, network interfaces, and more.
5. Set the Device to Sleep Mode
- adb shell input keyevent 26
- This simulates the pressing of the power button, which puts the device into sleep mode.
Conclusion
The Android CMD commands provide a powerful way to manage and control your Android device with precision. Whether you’re a developer, power user, or just someone who wants more control over their device, these commands enable you to:
- Install/uninstall apps.
- Manage files and storage.
- Gather device information.
- Perform system-level tweaks.
Using ADB commands helps streamline various tasks and provides a more efficient way to troubleshoot and automate processes on your Android device.
0 Comments