How To Run A Terminal Command On An Old Android Phone
The short answer: Android has no built-in terminal, so you use one of two tools.
Use ADB from a Windows, Mac or Linux computer, or install a terminal app like Termux on the phone itself.
Ars Technica recently ran a story about one terminal command giving a forgotten Android device a desk job. This guide shows how to run a command like that on your own old phone.
We have not verified the command from that story, so always use the exact command from the source you trust.
Table of Contents
- What a terminal command is
- What you need before you start
- Which method should you use?
- Step 1: Turn on Developer options
- Step 2: Turn on USB debugging
- Step 3: Install ADB on your computer
- Step 4: Connect the phone and run your command
- Option B: Run commands on the phone with Termux
- Safe commands to try first
- Go wireless on Android 11 or newer
- Common problems and fixes
- Safety tips before you paste any command
- Summary of the fix
- Still not working?
- Related topics
- More Android and Galaxy guides
What a terminal command is
A terminal command is a line of text you type to tell the phone to do something. It is typed instead of tapped.
Android phones do not come with a terminal screen. That is why you need a helper tool.
What you need before you start
Gather these items first. It saves a lot of back and forth.
- The old Android phone, charged to at least 50%
- A USB cable that carries data (some cheap cables only charge)
- A Windows, Mac or Linux computer
- The exact command you want to run, copied from a source you trust
Which method should you use?
Pick ADB for most jobs. It is Google’s own tool, and it can do things Termux cannot.
| Method | Where you type | Best for | Needs a computer? |
|---|---|---|---|
| ADB over USB | Computer | Commands that change phone settings | Yes |
| ADB over Wi-Fi | Computer | Cable-free control (Android 11 or newer) | Yes |
| Termux app | Phone | Linux-style tools and scripts | No |
Step 1: Turn on Developer options
Developer options is a hidden menu. You unlock it by tapping one item seven times.
- Open Settings.
- Tap About phone. On Samsung, tap About phone, then Software information.
- Tap Build number seven times.
- Enter your lock screen PIN if asked.
- Look for the message saying you are now a developer.
Step 2: Turn on USB debugging
USB debugging lets your computer send commands to the phone. Menu names vary a little by brand and Android version.
- Open Settings.
- Tap System, then Developer options. On Samsung, Developer options sits at the bottom of the main Settings list.
- Switch on USB debugging.
- Tap OK on the warning.
Step 3: Install ADB on your computer
ADB comes in a free Google download called SDK Platform-Tools. Get it from the Android Developers website only.
- Search for “Android SDK Platform-Tools” and open the result on developer.android.com.
- Download the version for your computer.
- Unzip the file. Our guide on how to unzip files covers the basics if you need help.
- Move the platform-tools folder somewhere easy, like your Documents folder.
Step 4: Connect the phone and run your command
Open a command window inside the platform-tools folder. Then check that the phone is seen.
- Plug the phone into the computer with the USB cable.
- On Windows, open the platform-tools folder, click the address bar, type cmd, and press Enter.
- Type adb devices and press Enter. On Mac or Linux, open Terminal in that folder and type ./adb devices.
- Look at the phone. Tap Allow on the “Allow USB debugging?” box. Tick “Always allow” if it is your own computer.
- Run adb devices again. Your phone should now show as “device”.
- Type adb shell to open a command line on the phone. Or type adb shell followed by your command to run it in one go.
Option B: Run commands on the phone with Termux
Termux is a free terminal app that runs right on the phone. No computer is needed.
The Termux project points users to F-Droid and its GitHub page for downloads, so start at the project’s own site.
- Install Termux from the source the project recommends.
- Open the app.
- Type pkg update and press Enter to refresh its tool list.
- Paste or type your command and press Enter.
Termux works inside its own sandbox. It cannot change deeper Android settings the way ADB can.
Safe commands to try first
These commands only read information. They are a good way to confirm everything works before anything bigger.
| Command | What it does |
|---|---|
| adb devices | Lists connected phones |
| adb shell getprop ro.build.version.release | Shows the Android version |
| adb shell pm list packages | Lists installed apps |
| adb reboot | Restarts the phone |
Go wireless on Android 11 or newer
You can skip the cable if the phone runs Android 11 or newer. Both devices must be on the same Wi-Fi network.
- Go to Settings, then System, then Developer options.
- Turn on Wireless debugging.
- Tap Pair device with pairing code.
- On the computer, type adb pair followed by the IP address and port shown on the phone, then enter the code.
- Type adb connect followed by the IP address and port shown on the main Wireless debugging screen.
Common problems and fixes
| Symptom | Likely fix |
|---|---|
| adb devices shows nothing | Try another cable or USB port. Make sure the cable carries data. |
| Shows “unauthorized” | Unlock the phone and tap Allow on the debugging prompt. |
| No Developer options menu | Repeat the seven taps on Build number. |
| Phone is not recognized on Windows | Install the phone maker’s USB driver, then reconnect. |
| “adb is not recognized” | Open the command window inside the platform-tools folder. |
If the phone is stuck on an Android robot with “No command”, see our guide on fixing the No Command screen.
Safety tips before you paste any command
Only run commands you understand and trust. Some can delete apps or wipe data.
- Copy commands only from reputable sources.
- Read the whole command before pressing Enter.
- Back up anything you want to keep. Our guide to backing up your Android phone to Google shows how.
- Turn off USB debugging when you are finished.
An old phone with outdated software may also behave differently than the one in a tutorial. Updating the phone manually first can help, if updates are still offered.
Summary of the fix
Unlock Developer options, turn on USB debugging, install Google’s Platform-Tools on your computer, then run adb shell with your command. Or install Termux and type commands on the phone.
Still not working?
Restart both the phone and the computer, then try a different data cable. Then run adb devices again and check the phone for the Allow prompt.
If it still fails, turn USB debugging off and on, or try the wireless method. Results can differ on very old Android versions, and we cannot promise a particular command will work on every model.
Related topics
- How To Turn On Developer Options On Any Android Phone
- How To Use An Old Android Phone As A Desk Clock Or Dashboard
- How To Factory Reset An Old Android Phone Before You Reuse It
- How To Fix USB Debugging Not Working On Android
More Android and Galaxy guides
- How To Fix "No Command" On An Android Phone (2026)
- How To Fix An Android Phone Stuck On The Logo (2026)
- How To Enter Recovery Mode On An Android Phone (2026)
- How To Fix An Android Phone That's On But The Screen Is Black (2026)
- How To Check Battery Health On An Android Phone (2026)
- How To Set An Alarm On An Android Phone (2026)