Termux Commands for Beginners: Packages, Storage, SSH and Shortcuts

The Termux commands to know first: pkg for packages, termux-setup-storage, SSH on port 8022, Termux:API, volume-key shortcuts, and what to run when something fails.

Termux is a terminal and a small Linux environment for Android. Everything happens by typing commands, which is the hard part for newcomers. This guide covers the commands you need first, in the order you’ll need them, with what each one actually does, taken from Termux’s own man page, its wiki and the source code of the version we host, 0.118.3.

One note on sources: the Termux Wiki has been frozen since April 2026. Its own notice says “new users and changes are not accepted on the wiki, and the current pages might be outdated”. Where a wiki page and the current code disagree, this guide follows the code.

The first three commands

1. Update everything:

pkg upgrade

Termux is a rolling release. Its man page warns: “You need to check for updates on a regular basis, especially before installing a new package. Otherwise at some day your environment may become broken.” The wiki suggests checking “at least once a week”. pkg upgrade picks a working mirror, refreshes the package lists and upgrades every installed package, so you don’t need a separate pkg update first.

2. Give Termux access to your phone’s storage:

termux-setup-storage

Android asks for the storage permission. Once you allow it, Termux creates a storage folder in your home directory with links to your phone’s shared storage: ~/storage/shared (the top level), plus downloads, dcim, pictures, music and movies, and external-1 and so on when there is an SD card or USB drive. Copy a file to your Downloads folder with cp file.txt ~/storage/downloads/.

If you get “Permission denied” on Android 11 or later even though the permission is granted, the wiki’s fix is to go to Settings › Apps › Termux › Permissions, revoke the storage permission and grant it again. The man page adds that since Android 11 Termux “may not be able to provide the access to shared and external storage”, and that file managers using the Storage Access Framework can still reach Termux’s home folder.

3. Pick package mirrors, if pkg complains:

termux-change-repo

It offers a group of mirrors that Termux rotates between (recommended) or a single mirror. Run it whenever you see “repository is under maintenance or down”, then pkg upgrade again.

Installing and managing packages

Termux uses Debian’s apt, wrapped in a shorter command, pkg. From the pkg source:

Command What it does
pkg install git Installs a package (short forms pkg in, pkg i)
pkg uninstall git Removes it; “Configuration files will be left intact” (apt purge removes those too)
pkg search editor Searches names and descriptions
pkg show git Shows version, size and dependencies
pkg list-installed Lists what you have installed
pkg files git Lists the files a package installed
pkg reinstall git Reinstalls a package
pkg update Only refreshes the package lists
pkg upgrade Refreshes the lists and upgrades everything
pkg clean Deletes downloaded package files to free space

What pkg adds over typing apt yourself: before install and search it refreshes the package lists when they are older than 20 minutes, and it checks mirrors and switches to another one if the current one has been in use for six hours or stops responding. If you use apt directly, the man page asks you to run apt update before installing and to upgrade with apt full-upgrade.

A few rules from the wiki: packages from Debian, Ubuntu and other distributions don’t work in Termux, older versions of a package can’t be installed (“Downgrading is not supported”), and pkg refuses to run as root.

If you type a command that isn’t installed, Termux usually tells you which package has it: “The program wget is not installed. Install it by executing: pkg install wget”.

Everyday commands

A fresh install already has the usual Linux basics, from the GNU core utilities and a few more packages in Termux’s bootstrap: ls, cd, pwd, cp, mv, rm, mkdir, cat, grep, find, tar, unzip, curl, less and the nano editor. The default shell is Bash.

Common next installs, with the package names Termux uses:

You want Install Then run
The Vim editor pkg install vim vim file.txt
Downloads from the command line pkg install wget wget URL (or curl -O URL, already installed)
Git pkg install git git clone URL
Python and pip pkg install python python, pip install …
Node.js and npm pkg install nodejs or pkg install nodejs-lts node, npm
SSH client and server pkg install openssh ssh, sshd (see below)
Manual pages pkg install mandoc man ls

Only one of the two Node.js packages can be installed at a time. The wiki warns about Python too: when Termux moves to a new Python version, for example from 3.8 to 3.9, the modules you installed with pip have to be installed again.

To get help for any command, try command --help or, with a manual viewer installed, man command. Press q to leave a manual page.

Where your files are

  • Your home folder is /data/data/com.termux/files/home, shortened to ~ and stored in $HOME.
  • Installed programs live under $PREFIX, /data/data/com.termux/files/usr, which plays the role of /usr on Linux. That’s why there is no /bin or /etc where Linux tutorials expect them.
  • Both are in Termux’s private app storage. The wiki warns: “if you uninstall the Termux application or wipe its data, directories $PREFIX and $HOME will be wiped too.” Keep anything important in ~/storage/shared or back it up.
  • Put files inside the folders ~/storage links to, not into ~/storage itself, which termux-setup-storage rebuilds from scratch when you run it again.

No root, and what sudo means here

Termux doesn’t need root and doesn’t give you root. Everything runs as one Android user with a name like u0_a231; whoami shows yours. There is no sudo out of the box. Termux does offer sudo and tsu packages, but they are wrappers for phones that are already rooted; the built-in su says Termux “does not supply tools for rooting”.

SSH: log in to your phone from a computer

pkg install openssh
passwd
sshd

passwd sets the password; password login is on by default. sshd starts the server, which in Termux listens on port 8022, not 22. Find the phone’s address with ifconfig, then connect from your computer with ssh -p 8022 192.168.1.20 (your address instead). Termux’s patch to the SSH server logs you in as the Termux user whatever name you give. Stop the server with pkill sshd. The same package gives you ssh for connecting from the phone to other machines.

Termux’s own commands

Command What it does
termux-wake-lock / termux-wake-unlock Keeps the CPU awake for long jobs with the screen off, at the cost of battery. Without it, the man page says, long tasks “will run very slowly or even be paused”
termux-open file.pdf Opens a file or link in another app. Since Termux 0.118, the man page says, this needs allow-external-apps = true in ~/.termux/termux.properties
termux-open-url https://… Opens a web address
termux-info Prints Termux, package and device details for bug reports
termux-reload-settings Applies changes to ~/.termux/termux.properties, colours or font
termux-backup / termux-restore Backs up or restores installed packages ($PREFIX), not your home folder; restoring deletes anything in $PREFIX that isn’t in the backup
termux-reset Erases everything under $PREFIX, all packages and their settings, keeping your home folder. A last resort

Phone features with Termux:API

Commands that read the battery, show notifications or use the camera need two things: the Termux:API app, and the command package installed with pkg install termux-api. The Termux:API app must come from the same source as Termux itself, because Termux and its plugins have to be signed with the same key; the Termux:API we host is F-Droid’s build, like our Termux. Some examples from the scripts’ own help:

termux-battery-status            # battery level and state, as JSON
termux-clipboard-set "hello"     # copy text to the clipboard
termux-clipboard-get             # print the clipboard
termux-toast "Done"              # a short pop-up message
termux-vibrate -d 500            # vibrate for 500 ms
termux-notification -t "Backup" -c "Finished"
termux-torch on                  # flashlight on (off to turn it off)
termux-tts-speak "Hello"         # read text aloud

If the Termux:API app is missing, these commands can hang instead of failing; Termux’s own termux-info script adds a timeout for exactly that case.

Keyboard shortcuts

Phone keyboards have no Ctrl or arrow keys, so Termux uses the volume buttons:

  • Volume Down works as Ctrl. Volume Down + C stops the running program (Ctrl+C), + D closes the session, + L clears the screen, + Z suspends a program, + A and + E jump to the start and end of the line.
  • Volume Up gives special keys. From the app’s source: W, A, S and D are the arrow keys; T is Tab; E is Escape; P and N are Page Up and Page Down; 1 to 0 are F1 to F10; H types ~, U types _ and L types |; Q or K shows or hides the extra keys row.

The extra keys row above the keyboard has, by default, two rows: ESC, /, -, HOME, UP, END, PGUP and TAB, CTRL, ALT, LEFT, DOWN, RIGHT, PGDN. You can change it in ~/.termux/termux.properties, for example:

extra-keys = [['ESC','TAB','CTRL','ALT','-','UP','DOWN']]

Then run termux-reload-settings. If you’d rather have the volume buttons change the volume, add volume-keys = volume to the same file.

Linux distributions

pkg install proot-distro
proot-distro install debian
proot-distro login debian

proot-distro runs a full Linux distribution, such as Debian, Ubuntu or Alpine, inside Termux without root, which helps with programs built for regular Linux. Version 5 downloads the systems as Docker images, so names like ubuntu:24.04 also work, and pd is a shorter name for the command. The wiki notes that PRoot only makes programs appear to run as root; “it does not provide any way for the real privilege escalation”.

When something goes wrong

  • “Repository is under maintenance or down” or 403 and 404 errors: run termux-change-repo, pick another mirror for every repository you use, then pkg upgrade.
  • [Process completed (signal 9) - press Enter] on Android 12 or later: Android’s limit on background processes killed it. The Termux README warns that Android will kill “any (phantom) processes greater than 32”. The fix the Termux maintainer documents depends on your Android version: on Android 14 and later, turn on Developer options › Disable child process restrictions; on Android 12L and 13, run adb shell "settings put global settings_enable_monitor_phantom_procs false" from a computer once; Android 12 needs a different device_config command that the same page describes, with a warning to use it at your own risk.
  • “App not installed” or signature errors when adding a plugin: Termux and all its plugins must come from the same source. The README’s fix is to uninstall Termux and every Termux plugin, then install all of them from one place.
  • Errors after not updating for a long time: run pkg upgrade. If even curl fails with “CANNOT LINK EXECUTABLE”, pkg itself suggests apt update && apt full-upgrade.
  • Termux won’t start a session: long-press the Termux icon and choose Failsafe, or open the left drawer, long-press New session and tap Failsafe. From there you can undo whatever broke the shell.

For add-ons that run scripts at boot, from home screen widgets or from Tasker, see our Termux plugins guide.

Apps in this guide

Sources

Related topics