Open Termux and run the following commands to update the environment and grant necessary permissions:
A USB On-The-Go (OTG) adapter or a double-sided USB-C cable to link both phones. 2. Prepare the Target Device
If a string of numbers followed by the word fastboot appears, your connection is secure and ready.
What is your target device? (e.g., Xiaomi, Samsung, Google Pixel)
Since fastboot requires raw USB access, you need root. In Termux, install tsu (Termux sudo): unlock bootloader via termux
Before attempting a phone-to-phone bootloader unlock using Termux, you must gather the necessary hardware and prepare both devices. Hardware Needed
Some guides suggest:
To successfully execute this process, ensure you have gathered the following components:
To unlock a bootloader via Termux, you need a : Open Termux and run the following commands to
These devices cannot be unlocked via standard fastboot commands. They require account binding via developer options and utilization of the proprietary Mi Unlock Tool, which requires a Windows environment. Termux will not work.
The bootloader is the first piece of code that runs when you press the power button. It loads the operating system (Android). Manufacturers lock the bootloader to prevent unauthorized modifications for security and DRM reasons (e.g., Widevine L1 for Netflix HD).
: A popup appears asking for USB permission. You grant it to Termux. Step 3: The Handshake You type your first command into the Termux terminal: adb devices
This guide provides a basic overview. Some devices have specific requirements or tools for unlocking the bootloader (e.g., Huawei, Xiaomi, and Samsung devices), so be sure to check for device-specific instructions. What is your target device
Connect the target device to the host device using the OTG adapter. Ensure the target device is in Fastboot Mode (usually by holding Power + Volume Down during boot). Establish Connection Verify the host recognizes the target device by typing: fastboot devices Use code with caution. Copied to clipboard If successful, you will see a serial number. Execute Unlock Command
. This process replaces the need for a PC by utilizing Termux's ability to run ADB and Fastboot commands. Essential Setup Requirements Host Device : An Android device with Termux:API installed. Target Device : The phone you want to unlock (must have OEM Unlocking USB Debugging enabled in Developer Options).
Look at the target phone's screen. A warning message will appear stating that unlocking the bootloader will wipe all user data and potentially void the warranty.
But this only works if the phone already has an unlocked bootloader or a custom recovery with OTG fastboot support — very uncommon.
If you lack a second Android device, consider these Termux alternatives.