Managing a mobile device via the command line opens up opportunities for the user that are not available in the standard graphical interface. Run Android via the console —this means getting direct access to the system, file structure and hidden settings of your smartphone or tablet. This approach is indispensable for developers, firmware modification enthusiasts and repair specialists who need to revive a device with a non-working screen or system.

The main tool for performing these tasks is Android Debug Bridge (ADB). This utility is a client-server app that provides communication between a computer and a mobile device. Without it, executing complex scripts, mass removal of system software, or installing custom recovery would be impossible. In this article, we will analyze in detail the process of setting up the environment and entering the first commands.

Preparing the working environment and installing drivers

Before trying to connect your computer to a smartphone, you need to make sure that you have the correct software on your PC. Standard Windows drivers often do not recognize the device in debug mode, so installing a specialized package Google USB Driver or universal drivers from the manufacturer is a mandatory step. Ignoring this stage results in the console simply not seeing the connected gadget.

To work, you will need to download the package Platform Tools from the official Android developers website. This archive contains executable files adb.exe and fastboot.exe, which are responsible for communication. Unpack the contents of the archive to the root of drive C or to any other folder with a short path to avoid errors when entering long commands in the terminal.

💡

To quickly check the operation of drivers, open Device Manager in Windows. When the phone is connected in debug mode, the “Android Device” or “ADB Interface” section without yellow exclamation marks should appear there.

After installing the drivers, the system should correctly detect the device when connected via USB. If "Unknown device" is displayed in Device Manager, try manually updating the driver by specifying the path to the unzipped folder Platform Tools. Sometimes you need to disable driver digital signature verification in Windows boot settings, especially when working with older smartphone models.

Activating debugging mode on the device

Without explicit permission from the user, the computer will not be able to send a single command to the phone. This security measure prevents unauthorized access to data if the device is lost or connected to an infected PC. To allow the connection, you need to activate a hidden section of the settings, known as For Developers.

The activation process is as follows:

  • 📱 Go to Settings and scroll down to the item About phone.
  • 🔢 Find the line Build number and quickly click on it 7 times in a row.
  • 🔓 After the message “You have become a developer” appears return to the main settings menu.
  • ⚙️ Open a new item For developers and activate the switch USB debugging.

When you first connect the cable to the computer, a dialog box will appear on the smartphone screen request for permission to debug from this computer. Be sure to check the box “Always allow from this computer” and click OK. Without confirming this request, the command adb devices will show status unauthorized, and any actions will be blocked.

☑️ Ready to connect

Done: 0 / 4

First launch and connection check

When the software part ready, and the phone settings have been changed, you can move on to the practical part. Open Command Prompt (CMD) or PowerShell in the ADB utility folder. To do this, it’s convenient to hold down the Shift key, right-click in an empty space in the folder and select “Open command window here.” This will save you from having to manually enter long paths to files.

Enter a basic command to check the visibility of the device:

adb devices

If everything is configured correctly, the console window will display a list of connected devices with their unique serial numbers and status device. Status offline usually indicates problems with drivers or cable, and the absence of a list at all indicates that debugging is not enabled or the cable is only used for charging.

📊 The status of your device in the console
device (everything is fine)
unauthorized (needs to be confirmed on the screen)
offline (problem with the driver)
the list is empty (does not see the device)

It is worth noting that some manufacturers, such as Xiaomi or Huaweimay require additional permissions. For example, in the MIUI shell, you must also enable the “USB debugging (security settings)” items and allow installation of applications via USB. These settings are located in the same menu for developers, but hidden deeper.

Basic system management commands

After successful connection, a wide range of possibilities opens up to you. You can manage files, install apps, take screenshots, and even emulate button presses. One of the most useful features is the ability to install APK files directly from the console, which is especially convenient when testing your own developments or installing modified versions of applications.

Consider the table of the main commands that are most often used by administrators and developers:

Command Description of action Example use
adb install Installing the application on the device adb install app.apk
adb pull Copying a file from the phone to the PC adb pull /sdcard/photo.jpg
adb push Copying a file from the PC to the phone adb push file.txt /sdcard/
adb reboot Rebooting the device adb reboot
adb shell Logging into the interactive Linux shell adb shell

Command adb shell deserves special attention, as it opens full access to the command line of Android itself, running on the Linux kernel. While inside this shell, you can execute commands not from the computer, but directly on the device, using user rights (and if you have root access, also superuser). This allows you to edit system files, change access rights and manage processes in real time.

Secret command for screenshots

You can take a screenshot of the phone screen with the command adb shell screencap -p /sdcard/screen.png, and then download it to your computer via adb pull /sdcard/screen.png. This works even if the screen sensor does not respond.

Working with Fastboot and bootloader

If the standard ADB mode is designed to work with the operating system turned on, then the mode Fastboot is used to interact with the device's bootloader. This is a critical tool for unlocking the bootloader, flashing individual memory sections (boot, recovery, system) and restoring bricks. The transition to this mode is usually carried out by a key combination when turning on or by the command adb reboot bootloader.

To check communication in Fastboot mode, use the command:

fastboot devices

In this mode, the possibilities are even wider, but the risks are higher. You can erase all data with the command fastboot erase userdata or flash a new recovery image fastboot flash recovery recovery.img. Be extremely careful: flashing the wrong image into the partition boot may cause the phone to stop booting altogether.

⚠️ Attention: Unlocking the bootloader via Fastboot on most modern smartphones (Samsung, Xiaomi, OnePlus) leads to a complete reset of all user data. Before executing commands fastboot oem unlock be sure to create a backup copy of important information.

Some manufacturers impose additional restrictions. For example, to unlock the device bootloader Xiaomi you need a special Mi Unlock Tool utility and linking your account to the device for a period of 3 to 7 days. Direct work through the Fastboot console in such cases will be blocked until official permission is received from the company's servers.

Solving common problems and connection errors

Even when strictly following the instructions, users often encounter technical difficulties. The most common problem is that the device is detected as “Unknown” or simply charges but does not respond to commands. In 90% of cases, the cable is to blame: many supplied cables only support power transmission and do not have lines for data transmission.

If the console gives an error error: device unauthorized, this means that you skipped the step with confirming debugging on the smartphone screen. Try disconnecting and reconnecting the cable while unlocking your phone screen. If the dialog box does not appear, go to the developer settings and disable and then enable USB debugging.

💡

The quality of the USB cable directly affects the stability of the connection. To work with ADB, use only original cables or certified analogues that support data transfer, avoiding cheap “charge-only” cables.

It is also worth considering the features of the computer’s operating system. On Linux and macOS, you may need to configure udev rules or set additional permissions to work with USB devices without root access. In Windows, problems are often solved by updating the driver through the device manager and selecting a specific .inf file from the Platform Tools folder.

⚠️ Attention: Shell interfaces (MIUI, OneUI, ColorOS) are constantly updated. The location of the “For Developers” menu items may change. If you do not find the desired switch, use the search in the phone settings by entering the word “debugging.”

Safety and risks when working with the console

Working with the console gives almost unlimited power over the device, which carries certain risks. An error in one command, for example when used rm -rf in a shell with root access, can permanently delete critical system files, turning the phone into a “brick”. Always double-check the commands you enter, especially those that involve deleting or overwriting partitions.

In addition, leaving USB debugging enabled when connecting your phone to public charging stations or other people's computers creates a data security vulnerability. An attacker could gain access to your file system or install malware without your knowledge. It is recommended to disable debugging immediately after completion of work.

Is it possible to run ADB without installing drivers?

In some cases, Windows 10 and 11 automatically load basic ADB drivers, but for stable operation and access to all functions (especially Fastboot), it is strongly recommended to install official drivers from Platform Tools or from the manufacturer devices.

Why does the adb devices command show the unauthorized status?

This status means that the device is physically connected, but the user has not confirmed permission to debug on the smartphone screen. Unlock the phone screen and click “Allow” in the dialog box that appears.

Is it safe to unlock the bootloader?

The unlocking procedure itself is safe for the hardware, but it erases all data from the device and may void the warranty. In addition, some applications (banking, Google Pay) may stop working on an unlocked bootloader due to a violation of the integrity of the security system.

How to exit Fastboot mode if the phone is frozen?

Usually, holding the power button for a long time (10-15 seconds) until a forced reboot helps. If this does not help, you can try a command fastboot reboot from your computer or a combination of the power and volume buttons (depending on the model).

Do you need root access to work with ADB?

No, basic ADB commands (installing applications, copying files, removing logs) work without root access. However, to access protected system folders within a command adb shell or to deeply modify the system, superuser rights will be required.