What is Termux? A Beginner's Guide to Termux

What is Termux? A Beginner's Guide to Termux Blog Banner

Hey everyone, I was planning to write my next article—which I mentioned in my previous post about “How to Customize the Vim Editor on Termux to Make It Look Like VSCode.” That’s when I thought: how many people actually know about Termux and how to use it? If you're one of them, this article is for you. Before diving into Termux commands, let's talk about what Termux is.

What is Termux?

Termux is a free and open-source terminal emulator for Android that provides a Linux environment without the need for root access. If your device is rooted, it becomes even more powerful, allowing you to use additional tools such as chroot. In simple terms, it transforms your Android device into a mini Linux workstation, enabling you to install extra Linux packages via its package manager (which is based on Debian’s APT).

Termux gives you access to most standard Linux commands and shells, allowing you to run scripts, compile code, and more. With Termux, you can install tools for programming (e.g., Python, JavaScript, Java), networking, security, and text editing (e.g., Vim, Nano, Emacs).

Beyond the basic terminal, Termux supports add-ons like Termux:API, Termux:Styling, and Termux:Boot, and you can install packages like OhMyZsh.

You can download Termux via F-Droid or directly from GitHub. I personally prefer the GitHub version because it's the most updated version available. You can also download it from the Play Store, but don't install it because the Play Store version is no longer actively maintained and, due to new security policies (Android 10 onward), it faces compatibility issues.

Overall, Termux is a powerful tool for developers or anyone who wishes to become a software developer but doesn't have access to a computer.

Now, let’s dive into Termux commands.

Basic Package Management

Update and Upgrade

Every time you open Termux, make sure your terminal is up-to-date by updating and upgrading it before use.

  • Update Package List:
    pkg update
    apt update
    Updates the package list from the Termux repositories.
  • Upgrade Packages:
    pkg upgrade
    apt upgrade
    Upgrades all installed packages to their latest version.
  • Combine Update and Upgrade:
    pkg update && pkg upgrade
    Alternatively, you can combine both commands in a single line.

Installing and Searching for Packages

  • Install a Package:
    pkg install <package>
    Installs a package (e.g., pkg install python).
  • Search for a Package:
    pkg search <keyword>
    Searches for packages matching the keyword.

Standard Linux File Management

These are the same commands you’d use on any Linux system:

  • ls - List files and directories
  • cd <directory> - Change the current directory (this command takes you inside a specific directory)
  • mkdir <dir> - Create a new directory (e.g., mkdir my-project)
  • cp <source> <destination> - Copy files or directories (e.g., cp files.txt home/my-folder)
  • mv <source> <destination> - Move or rename files/directories (e.g., mv files.txt home/my-folder or mv app.py application.py)
  • rm <file name> - Remove a file (deletes a file). Use rm -r for directories.
  • cat <file name> - View file contents
  • nano <file name> or vim <file name> - Edit file contents

Termux-Specific Commands

Storage and Repository Management

  • Set Up Storage:
    termux-setup-storage
    Prompts you to grant Termux permission to access your device’s storage.
  • Change Repository:
    termux-change-repo
    Allows you to change the package repository mirror for faster downloads. Select a repository mirror based on your nearest location.

Power and System Info

  • Prevent or Allow Sleep:
    termux-wake-lock
    termux-wake-unlock
    Prevents or allows the device to sleep while Termux is running.
  • Display System Info:
    termux-info
    Displays detailed information about your Termux installation environment.

Clipboard and Notifications (requires termux-api package)

  • Set or Get Clipboard Content:
    termux-clipboard-set
    termux-clipboard-get
    Retrieves or sets the Android clipboard content.
  • Open a File or URL:
    termux-open <file or url>
    Opens a file or URL with an appropriate app on your device.

Multiplexing and Process Management

  • Start a Terminal Multiplexer Session:
    tmux
    Useful for running multiple tasks simultaneously.
  • Interactive Process Viewer:
    htop
    An interactive process viewer.

Termux Add-ons

These are not commands, but apps you can install via F-Droid to expand Termux's capabilities:

  • Termux:API – Integrates Android functions into the CLI.
  • Termux:Styling – Lets you change fonts and colors.
  • Termux:Boot – Runs commands automatically at device startup.
  • Termux:Widget – Integrates Termux scripts with home screen widgets.
  • Termux:Tasker – Integrates Termux scripts for automation.

I discovered a new add-on on F-Droid while researching for this article—a plugin for Termux that enables an Android GUI for terminal applications. I haven't tested it yet, but it sounds interesting. If you want to check it out, click here.

Conclusion

These are the basic Termux commands you need right now. With these commands, you can interact with Termux and browse the internet. As you explore, you'll surely find more interesting Termux commands. By the way, with Termux you can do more than just simple tasks—you can install popular distros like Ubuntu, Debian, Arch, Kali Linux, etc. You can even run a virtual desktop and customize it as your own. That’s all I want to share with you today. If you like my article, please leave a comment—whether it's criticism or appreciation—as it would mean a lot to me and help me improve.

Comments

Popular Posts