I use KUBUNTU on my laptop, but this goes for any Linux distro. I can open a terminal window and type in things like sudo apt-get update
, sudo apt-get install packagename.
Is there a terminal that can carry out commands like this on Android? It doesn't have to be "sudo", I simply mean carrying out commands. I use the Galaxy S3, but I doubt it really matter for the question I'm asking.
6 Answers
Summing up from the comments:
First you need to understand that updating apps works different on Android than it does on a "normal" Linux distro: There is no such thing as "apt". Though Android has its own package manager (listening to the pm
command), installs/updates are usually dealt with by services/apps like google-play-store or other alternative-markets. pm
would rather be comparable with dpkg on Debian-based systems: it can do local installs (i.e. with the .apk
file already present on the device itself: pm install
would be the command for that), and a lot of other things.
Apart from that: a terminal app can be compared with a terminal on Linux allright. You get a text-mode "window" where you can execute commands. Most are even similar to those available on Linux, as Android is Linux based: you have things like cd
, ls
, grep
, and more. For details on this, you might wish to take a look at e.g.
- Ten basic Android terminal commands you should know (AndroidCentral)
- Using the terminal (XDA)
- Android Terminal Commands (XDA)
- Android Shell Command Reference (Github)
- our command-line tag-wiki
A look into our terminal tag-wiki will not hurt either :)
I'd say all terminal apps available for Android should support the above. Some even offer additional features, such as an entire development environment (Terminal IDE), or access to remote servers (JuiceSSH).
-
Also worth mentioning, installing busybox adds all the commands "you know and love"– saloalvJan 7, 2015 at 18:09
-
Right, @saloalv – with the amount of commands depending on the version of Busybox :) Don't forget installing Busybox system-wide usually requires root.– Izzy ♦Jan 7, 2015 at 21:52
-
if it'd be possible to install !system-wide, it'd be great for non-rooted users. Unfortunately it seems that the sdcard partition is fat32, and as such the binary cannot be given execution rights– saloalvJan 7, 2015 at 22:51
-
1@saloalv that's not even the culprit. But it is explicitely mounted with the
noexec
flag (for security reasons).– Izzy ♦Jan 7, 2015 at 23:56
There is a terminal app which uses "apt" to install packages. Its awesome and has lots of packages ported for arm devices -- Termux & Playstore Link
in present days there is the app "termux" on google play store. it comes with a full unix/linux shell and with apt. anything else should be straight forward then. downside: it does not support items like my Android 4.4.2 based tablet.
Install Terminal Emulator and Busybox in your Android. Terminal Emulator gives command-line window and Busybox APK gives useful commands that are used in Linux like wget
, chmod
, chroot
and more.
Assuming that:
- Your Android device is rooted;
- The
su
binary is located at/system/xbin/su
; - The shell binary is located at
/system/bin/sh
; and - Your Android device has Terminal Emulator installed.
If all the 4 conditions above are satisfied, then:
If you want to enter the shell and become root (superuser uid 0) so you can execute commands without uid restrictions, start the Terminal Emulator app and just execute this command:
su -
In order to disconnect from the uid 0 (exit superuser status), press Volume - and D, or type
exit
and hit EnterAlternatively, if you want to always start Terminal Emulator as root, then start Terminal Emulator, go to Preferences, scroll down to the SHELL section, tap the Command line option and modify the command so it becomes this:
/system/xbin/su -c "/system/bin/sh -"
After you change the command, exit Terminal Emulator (close the application) and start it again. Notice how Terminal Emulator's shell interface now shows you
root@something
by default.
If you want to add extra commands to your rooted Android system, install BusyBox.
In case your Android device isn't rooted, you still can use Terminal Emulator in order to execute some basic (user) commands such as blkid
, cat
, cd
, clear
, cp
, du
, grep
, id
, ln
, ls
, ping
, sleep
, uptime
et cetera.
su
and other common GNU commands by rooting your device and installing Busybox (busybox is usually installed while rooting) but you can't get apt since it's a package manager for Debian-based distros. Android is not a linux distro, the only common thing it has is the linux kernel.