Skip to main content

Termux Commands

Robot mascot consulting a reference manual beside a terminal window

Reference for Termux-specific commands used within the ADL environment. Covers package management, storage access, session control, and the Termux API.

Package Managementโ€‹

Termux uses pkg as its primary package manager. pkg is a wrapper around apt that automatically runs apt update before install operations, ensuring you always pull from the latest package index. You can use apt directly if you prefer, but you must run apt update manually before installing or upgrading.

Featurepkgapt
Auto-updates package indexYesNo
Syntaxpkg install <name>apt install <name>
BackendCalls apt internallyDirect dpkg frontend
Recommended for TermuxYesOnly if you need fine-grained control

Core Commandsโ€‹

CommandDescriptionExample
pkg install <package>Install one or more packagespkg install git nodejs
pkg uninstall <package>Remove a packagepkg uninstall nodejs
pkg list-installedList all installed packagespkg list-installed
pkg list-allList all available packages in the repopkg list-all
pkg search <query>Search for packages by name or descriptionpkg search python
pkg updateUpdate the package indexpkg update
pkg upgradeUpgrade all installed packages to latest versionspkg upgrade
pkg show <package>Show detailed info about a packagepkg show openssh
pkg files <package>List files installed by a packagepkg files curl
pkg cleanClear the local package cachepkg clean
$pkg update && pkg upgrade -y
โœ…๐Ÿ’ก Batch installs

Chain multiple packages in a single install command to avoid repeated index updates: pkg install git curl wget openssh -y

Common Package Groupsโ€‹

Useful package sets for a typical ADL setup.

Core utilities:

$pkg install coreutils findutils grep sed gawk tar gzip -y

Development tools:

$pkg install git nodejs python build-essential clang cmake -y

Networking and remote access:

$pkg install openssh curl wget nmap rsync -y

Shell and terminal:

$pkg install zsh tmux neovim htop tree -y

File and text processing:

$pkg install jq ripgrep fd fzf bat -y
โญKeep packages current

Run pkg update && pkg upgrade -y regularly to avoid dependency conflicts when installing new packages.

Storageโ€‹

Termux runs in its own sandboxed filesystem. To access shared Android storage (Downloads, DCIM, etc.), you must grant storage permission first.

Setting Up Storage Accessโ€‹

$termux-setup-storage

Running this command prompts for the Android storage permission and creates symlinks under ~/storage/.

โš ๏ธRun only once

You only need to run termux-setup-storage once. Running it again will recreate the symlinks but should not cause issues.

Important Pathsโ€‹

PathDescription
/data/data/com.termux/files/homeTermux home directory (~)
/data/data/com.termux/files/usrTermux usr prefix ($PREFIX)
~/storage/sharedAndroid internal storage root
~/storage/downloadsAndroid Downloads folder
~/storage/dcimAndroid DCIM (camera photos)
~/storage/musicAndroid Music folder
~/storage/moviesAndroid Movies folder
~/storage/picturesAndroid Pictures folder
~/storage/external-1External SD card (if available)
โ„น๏ธNote

Files stored inside /data/data/com.termux/files/ are private to Termux and not accessible to other Android apps without root. Use ~/storage/shared when you need files visible to other apps.

Sessionsโ€‹

Reloading Settingsโ€‹

$termux-reload-settings

Reloads ~/.termux/termux.properties without restarting the Termux app. Use this after editing font, color scheme, or keyboard settings.

Setting filePurpose
~/.termux/termux.propertiesTerminal behavior, extra keys, bell, etc.
~/.termux/colors.propertiesTerminal color scheme
~/.termux/font.ttfCustom terminal font

Termux API Commandsโ€‹

These commands require the Termux:API add-on app to be installed from F-Droid (or the same source as your Termux install) and the termux-api package.

$pkg install termux-api -y
โš ๏ธWarning

The Termux:API Android app and the termux-api package must come from the same distribution source (both from F-Droid or both from GitHub releases). Mixing sources causes silent failures.

Device and Systemโ€‹

CommandDescriptionExample
termux-battery-statusBattery level, status, temperature in JSONtermux-battery-status
termux-brightness <0-255>Set screen brightnesstermux-brightness 200
termux-vibrateVibrate the devicetermux-vibrate -d 500
termux-volume <stream> <vol>Set volume for a stream (music, ring, alarm, notification)termux-volume music 10
termux-wifi-connectioninfoCurrent Wi-Fi connection details in JSONtermux-wifi-connectioninfo
termux-telephony-deviceinfoDevice and SIM information in JSONtermux-telephony-deviceinfo
termux-locationGet device GPS/network location in JSONtermux-location -p gps

Clipboardโ€‹

CommandDescriptionExample
termux-clipboard-getPrint current clipboard contents to stdouttermux-clipboard-get
termux-clipboard-set <text>Set clipboard contentsecho "text" | termux-clipboard-set
$termux-clipboard-get

Notifications and Feedbackโ€‹

CommandDescriptionExample
termux-notificationShow an Android notificationtermux-notification -t "Title" -c "Content"
termux-toastShow a short popup toast messagetermux-toast "Build complete"
termux-tts-speakSpeak text aloud via text-to-speechecho "done" | termux-tts-speak
$termux-notification -t 'ADL' -c 'Task finished' --id adl-notify
โœ…๐Ÿ’ก Tip

Use the --id flag with termux-notification to update an existing notification instead of creating a new one. Useful for progress tracking in scripts.

File Sharing and Downloadsโ€‹

CommandDescriptionExample
termux-downloadDownload a file using the system download managertermux-download "https://example.com/file.zip"
termux-shareShare a file or text via the Android share menutermux-share -a send image.png

Camera and Mediaโ€‹

CommandDescriptionExample
termux-camera-photo <file>Take a photo with a device cameratermux-camera-photo -c 0 photo.jpg

The -c flag selects the camera: 0 for rear, 1 for front.

SMSโ€‹

CommandDescriptionExample
termux-sms-listList SMS messages in JSONtermux-sms-list -l 10 -t inbox

Flags: -l limits the count, -t sets the type (inbox, sent, draft, all).

โ„น๏ธPermissions

Termux API commands require their corresponding Android permissions. The first invocation of each command may trigger a system permission dialog (camera, location, SMS, etc.). Denied permissions cause the command to return empty output or an error.

Scripting with Termux API

Termux API commands output JSON, making them straightforward to parse in scripts:

# Check if battery is above 20%
battery=$(termux-battery-status | jq '.percentage')
if [ "$battery" -lt 20 ]; then
termux-notification -t "Low Battery" -c "Battery at ${battery}%"
fi
# Copy current working directory to clipboard
pwd | termux-clipboard-set
# Notify when a long-running command finishes
make build && termux-toast "Build succeeded" || termux-toast "Build failed"