Linux on Android phones

Extremely fast installation guide (5 steps).

Open this web page on your phone so that you can copy-paste things (instead of typing them).

Go to and install and open (run) termux. See screenshots below to get an idea of what termux looks like.

Copy-paste the following line into termux (and then press ENTER) :

curl -O

Copy-paste the following line into termux (and then press ENTER) :


Close termux by typing exit (and then ENTER). Done.

Screenshots from the installation.

First view of termux. Stay calm and continue ... alt Initial screen

After giving the first command (and before hitting ENTER) ... alt First command 1

After the first command finishes ... alt First command 2

After giving the second command (and before hitting ENTER) ... alt Second command 1

While the second command is still executing (don't stop it!) .... alt Second command 2

After the second command finishes ... alt First command 1

Just before hitting ENTER to close the app ... alt First command 1

Testing that everything works ...

You can test that everything has been installed correctly by typing the commands shown in the screenshots that follow. I'm sure you can figure-out what you have to type by comparing what you see on your phone with what you see in the screenshots. Having said that, and to give just one example, for the first screenshot you'd have to type ls -lF , then cd progs , then ls -lF , and finally nano test.c (hit ENTER after each command).

alt First command 1

nano is a text editor (like notepad or wordpad). What you see in front of you is a program written in the C programming language (and contained in the file named test.c that you've typed). Don't change the program (at least for now). You can move around the file with the arrow keys. To exit nano : first hit the extra key that says CTRL on it, then hit the key X.

alt First command 1

Once you are out of nano and back in the unix shell, type CTRL-D twice to close the unix shell (CTRL-D means that you first hit the extra key that says CTRL, and then the key D).

Limitations and criticism

The take-home message is this : you can do your unix and programming exercises on your android phone/tablet. By following the instructions given above (a) you will install a minimal linux-like environment on your phone in the form of a normal android application, (b) nothing bad will happen to your phone/tablet (it is just another app you've installed), and, (c) everything is completely free, you will not have to pay a dime.

The limitations are :

(a) The procedure above will only work with recent versions of android (version 5 and later). This is probably true for all phones made after 2014.

(b) The phones usually have small screens and if the virtual keyboard takes half the screen, you'll be left with very little space to work. If by any chance you are uncomfortable with the virtual keyboard, you may want to consider the possibility of buying an external keyboard. Prices for USB or Bluetooth external keyboards start at about 9 euros. Not all keyboards on the market are compatible with each and every phone out there, so if you decide to buy one, do try to choose a keyboard that works with your phone (ask your local android guru for advice).

(c) There are some differences between a proper linux installation and what you'll get on your phone, but they are minor differences that will not stop you from learning what you need to know about the unix shell and to do some simple programming with C and perl (and python and nodejs if you want).

Advanced shell usage

If you feel comfortable with the unix shell and you want to add some bells and whistles to it (like automatic completion suggestions, fuzzy searches of files and history, a beautiful status line for the vim editor, etc), do the following :

Close and open again termux.

Copy-paste (and then ENTER) :

curl -O

Copy-paste (and then ENTER) :


Type CTRL-D twice to close everything.

Re-open the shell and enjoy.

Quick start guide :

  • To accept the suggestion offered by the shell, click 'RightArrow' (or type CTRL-F) :

alt adv 1

  • To see the possibilities and select between them, hit TAB (again and again) and then ENTER :

alt adv_2

  • You are trying to remember a flag for the command find, but to no avail. Type find - and hit TAB :

alt adv_0

  • You want to edit one of your files, but the only thing you remember is that its name contains the characters 'pl' and that it is a C program. Type what you know, hit CTRL-T and select the correct :

alt adv_3

  • You have a sub-directory called misc somewhere. But where ? You type 'misc', then ALT-C, select the correct, hit ENTER. You will automatically be taken to that directory :

alt adv_4

  • Once upon a time you had typed a long command with an https address. But which one ? Type https, hit CTRL-R, select the correct one, and hit ENTER :

alt adv_5

  • ... and for completeness, a screenshot of the vim editor with the airline status line (and two files open) :

alt adv_6

Reading material for the dedicated