UnixDroid

Lesson 2 of 5 · 6 min

First steps in Termux

Update Termux, install your first packages, reach your phone storage and learn the shortcuts that make typing easy.

A fresh Termux install needs a few minutes of setup. Do these steps once and everything later goes smoothly.

The first Termux commands to run, in order
The first Termux commands to run, in order

Step 1: Update everything

pkg update && pkg upgrade

Press Enter (or type y) whenever it asks a question. If downloads are slow or fail, run termux-change-repo and pick a different mirror.

Step 2: Install a few useful tools

pkg install python git nano

Check they worked:

python --version
git --version

Step 3: Reach your phone storage

By default, Termux can only see its own home folder. To reach your Downloads and other files:

termux-setup-storage

Allow the permission when Android asks. A new folder appears at ~/storage, with shortcuts such as ~/storage/downloads and ~/storage/shared.

Typing shortcuts

  • The extra keys row above the keyboard gives you ESC, CTRL, ALT, TAB and arrow keys.
  • Volume Down works as Ctrl. So Volume Down + C is Ctrl+C, which stops a running command.
  • Tab completes file and command names. Use it constantly.

Your first script

nano hello.py

Type print("Hello from Termux"), save with Ctrl+O then Enter, exit with Ctrl+X, and run it:

python hello.py

Your Termux home folder is /data/data/com.termux/files/home. Uninstalling Termux deletes it, so keep important scripts in Git or in ~/storage/shared.

Try it yourself
  1. Run pkg update && pkg upgrade.
  2. Install python and git and check their versions.
  3. Run termux-setup-storage, then ls ~/storage/downloads.
  4. Write and run the hello.py script.

Quick check

Which command gives Termux access to your phone storage?

Need a hint?

termux-setup-...

Finished this lesson?

Done lessons keep your daily streak going 🔥

0 day streak

0 lessons done

best 0 days

Log in to keep your streak on every device →