Questions tagged [command-line]

A "command line" is a text interface to enter commands interactively. In our context, it usually means a "Unix Shell" in a terminal app, or the ADB shell on a computer to interact with an Android device.

What does 'command line' stand for?

To interactively enter system commands, Android offers a command line interface, in short "CLI". This can be accessed either directly on the device using a terminal app such as e.g. Android Terminal Emulator, or from a computer using ADB's adb shell command.

Terminal Emulator
Running a terminal emulator on the Android device (Source: Google Play)

Where should I use this tag?

Obviously, when your concern is to directly execute commands on the command line on your Android device (directly or remotely).

What is not covered by this tag?

Again quite obvious (if you've read our FAQ): Development issues are off topic at our site. So if your question is development orientated, don't use this tag -- don't even post that question ;)

Related tags

  • : about e.g. execute shell commands via adb shell
  • : about scripting of shell commands
  • : shell-specific issues
  • : using a terminal app to access the command line

Sources

238 questions
31
votes
3 answers

What's the best way to restart Android via command line (remotely)?

I'm looking for the best / friendliest way to reboot my rooted android 4.1.1 device. I found these solutions so far: su -c "reboot" - Causes problems with wifi after restart on my device... I read that this can cause a currupt file system in some…
acy
  • 459
  • 1
  • 5
  • 10
30
votes
1 answer

pm hide VS pm disable -- the identity crisis

What's the need of pm disable when pm hide already does its job? I've compiled some information based on my search and research: click here to see the table (edited). As you can see, pm hide can achieve what pm disable can, but without needing root…
Firelord
  • 25,528
  • 21
  • 129
  • 295
27
votes
3 answers

Open command prompt to access folders of a USB connected Android phone

If I connect a Phone with my Windows 7 machine via USB, it shows up in explorer with a name e.g. Nexus 5. How can I open a command prompt and change directory to this device. For lettered drives, I can just type D: F: etc.
user
  • 373
  • 1
  • 3
  • 6
25
votes
12 answers

Are there any command line SSH clients available for rooted Android phones?

I of course have ConnectBot, but I'm looking for something I can script. Edit: To clarify here, I'm not interested in running scripts from a terminal. What I want to do is run an SSH command in an automated/scheduled manner. Tasker and Locale…
TREE
  • 1,172
  • 1
  • 8
  • 17
24
votes
3 answers

How to return to the home screen with a terminal command?

Is there a terminal command to go to the home screen? I need to do this via ssh, so I cannot just push the "home" button, I need to send a command-line action..
Andrea
  • 427
  • 2
  • 5
  • 7
20
votes
4 answers

Android Read recent SMS messages from command line

I have recently broken my Android's screen. (Again) Its a T-Mobile G2 Trying to keep up with my busy technology related life is hard enough without losing my link with everyone. I have rooted the phone and have the USB Debugging already turned on.…
The Lazy Coder
  • 301
  • 1
  • 2
  • 6
19
votes
3 answers

A way to get the current resolution size and DPI from the command line/terminal/adb?

I've got adb access to my android phone. So I know that I can override screen density and screen resolution with the am command provided with Android. That's great and dandy, I guess. But is there a way to grab those two numbers from the command…
Ehtesh Choudhury
  • 347
  • 1
  • 2
  • 10
19
votes
4 answers

Why can't I get root access from shell?

> adb shell sh-4.1$ su Permission denied I have rooted my phone successfully. I know this because I'm able to install apps on SD card and I have a program called SD Maid that is able to operate with root permissions.
Kshitiz Sharma
  • 489
  • 2
  • 5
  • 13
18
votes
2 answers

Read APK permission by shell command

I want to read the requested permissions of an .apk file on the computer (android sdk is installed) via command line. I.E.: $ android read-permissions /path/to/someapp.apk I know this is possible, I just cant find the proper command.
whlk
  • 393
  • 1
  • 2
  • 7
18
votes
1 answer

Is there a way to switch Android users from the command line?

Using the following command, I managed to enable multi-user mode in an Android device that doesn't officicially support it: adb shell setprop fw.max_users 5. For good measure I also added the following entry to the build.prop…
Freeze-Droid
  • 181
  • 1
  • 1
  • 3
18
votes
2 answers

Toggling USB mass storage on (or off) via adb commands

Background: I have a USB stick Android device (e.g. RikoMagic) which I mostly run in "headless" mode. Among other things, I've already figured out how to shut it down via a combination of adb and the internal "am" command: adb shell am start -n…
Anonymous Howard
  • 183
  • 1
  • 1
  • 5
18
votes
3 answers

Turn phone on with ADB or Fastboot?

My power button seems to have busted, is there a way I can boot my phone using ADB or Fastboot or some other command line interface?
Tyler
  • 443
  • 1
  • 4
  • 12
18
votes
1 answer

How to install app from command line (terminal)?

How to install app from command line (terminal)? I would like to start a terminal window and do the apk installation from command line (shell script) EDIT1: within the phone. Also is it possible to install from Google Play from URL, instead just a…
klor
  • 412
  • 3
  • 6
  • 15
16
votes
4 answers

Installing an app from Play Store using the command line

Is it possible to install an app from Play Store using the command line and if yes, how? What I am trying to accomplish is something similar to using adb install file.apk but instead of an apk file the target would be a package name of a Play Store…
16
votes
1 answer

Launch AVD manager from command line

I'm on Windows 10. Android studio version 2.3.3 How can I launch the AVD Manager with-out opening the Android Studio and creating a project ? I remember it was possible for earlier version of Android Studio. I found the avdmanager.bat file in…
nkg
  • 261
  • 1
  • 2
  • 5
1
2 3
15 16