0

Since Android is linux, cant i use standard linux commands inside android? I know there are applications that allow for a "Command Line Interface" (CLI). I also imagine that adb would provide access to command input (possibly as root?).

  • Can i run bash scripts and use commands like mkdir, rm, and cp in android?

  • If not what caommands can i use? does google provide a list?

  • How would i input CLI commands in android? ADB?

    • Does adb provide root?

Note: I run an android emulator, from Eclipse, with Fedora 20 as my OS. I do not presently have an android device to work with, or i would probably just tinker until i figure it out.

Any and all information is greatly appreciated.

2
3

Yes, Android has a command-line interface just like a desktop GNU/Linux system. But because it's an embedded system without storage space to throw away on features most users don't want, there aren't a lot of commands installed by default: just some specific ones used to interact with Android services (such as am and pm). Because the manufacturer can customize the system image, there's no definitive list of what commands are available: it varies from device to device.

To add more commands, you can install Busybox, which is a single package containing a set of the most-used Unix command-line utilities. There are several "Busybox installer" apps on Google Play, but as it's open-source, you can also install it from F-Droid or build it yourself from source.

As you've already seen, there's a wide variety of terminal emulator apps. These run on your Android phone and provide a window into which you can type commands and see the results. Often they come with SSH clients and the like built-in, because the most common use for a terminal emulator on an Android phone is to SSH into a bigger computer.

In addition, running adb shell from a desktop computer that's connected to the phone via ADB gives you a shell on the phone. You can instead run adb shell command to run command in a shell on the phone.

Neither of the above methods of starting a shell make you root by default, but if your phone is rooted, you can use the su command in the usual way to become root. Whichever root manager you have on your phone (Superuser, SuperSU, etc.) will probably pop up on the screen for you to confirm the root access.

Shell scripts run on Android in the usual way, but as I've already mentioned, you don't get a lot of commands to play with by default, so many scripts written for desktop simply won't work.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.