Some handy commands to use in Termux

Basic commands

  • cat <file>: Display the contents of a file.
  • termux-setup-storage: Grant Termux access to the Android file system.
  • clear: Clear the terminal screen.
  • history: Show the command history.
  • pwd: Print the current working directory.
  • ls: List files and directories.
  • cd <directory>: Change to a specified directory.
  • mkdir <directory_name>: Create a new directory.
  • touch <file>: Create a new empty file.
  • rm <file>: Delete a file.
  • mv <source> <destination>: Move or rename files.
  • cp <source> <destination>: Copy files or directories.

Update and upgrade Packages (software)

  • pkg update: Update package lists from repositories.
  • pkg upgrade: Upgrade all installed packages.
  • pkg install <package_name>: Install a specific package.
  • pkg uninstall <package_name>: Uninstall a specific package.
  • pkg search <query>: Search for a package by name or keyword.
  • pkg show <package_name>: Show detailed information about a specific package.
  • apt list --installed: List all installed packages.
  • pkg list-all: List all available packages.
  • pkg autoclean: Remove unnecessary packages.

Handle files and folders

  • stat <file>: Show file or directory status.
  • ls: List files and directories.
  • pwd: Print the current working directory.
  • cd <directory>: Change to a specified directory.
  • cp <source> <destination>: Copy files or directories.
  • mv <source> <destination>: Move or rename files or directories.
  • rm <file>: Remove a specified file.
  • rmdir <directory>: Remove an empty directory.
  • touch <file>: Create a new empty file.
  • cat <file>: Display the contents of a file.
  • head <file>: Show the first 10 lines of a file.
  • tail <file>: Show the last 10 lines of a file.
  • stat <file>: Show file or directory status.

Edit text in files

  • nano <file>: Edit files with the Nano editor.
  • vim <file>: Edit files with the Vim editor.
  • cat <file>: Display the contents of a file.
  • sed 's/old/new/g' <file>: Replace ‘old’ with ‘new’ in a file.
  • grep <pattern> <file>: Search for a specific pattern in a file.

For network connections

  • ping <host>: Test connectivity to a specified host.
  • ifconfig: Show network interfaces and configurations.
  • curl <URL>: Download a file from a specified URL.
  • wget <URL>: Fetch files from the web using wget.
  • ssh user@host: Connect to a remote system using SSH.
  • traceroute <host>: Trace the route to a network host.
  • netstat: Display network connections and listening ports.
  • nslookup <domain>: Query the DNS for a specific domain.

Termux-API command

  • termux-battery-status: Get battery status and information.
  • termux-location: Get the current device location (GPS).
  • termux-vibrate: Make the device vibrate.
  • termux-wifi-scaninfo: Get information about Wi-Fi networks.
  • termux-telephony-call <phone_number>: Make a phone call from the terminal.
  • termux-telephony-sms-send <phone_number> "<message>": Send an SMS.
  • termux-camera-photo <file_path>: Take a photo using the device camera.