
If you have a modest Android phone or tablet, such as an entry-level Samsung, and you're still itching to get into programming, you're in luck: with Termux you can set up a small Linux environment in your pocket and start tinkering with C, C++, Python, HTML and CSS without needing a computerThe idea sounds a bit geeky, but as soon as you try it you see that it is totally viable for learning to program and for doing real projects.
In the following lines we will see how to take advantage of Termux to Program in Python and C++ from your Android tablet or mobile device.You'll learn which packages to install, how to compile from the terminal, what kinds of projects you can create, and which tools to add. Plus, you'll find practical tips for beginners, helpful links to documentation, and a brief introduction to connecting all of this to cybersecurity and automation, all while keeping in mind that you're working on a mobile device.
What is Termux and why use it for Android programming?
Termux is an Android application that offers you a Complete Linux environment inside your mobile phone or tabletNo root access or complicated tricks required. It's like opening a Linux terminal on your phone: you can install packages, use your own package manager, edit files, compile programs, run scripts, and much more.
The great advantage is that Termux It removes many typical barriers to learning to program.You don't need a powerful laptop, you don't have to set up virtual machines or deal with complicated installations. With your Android device and a good internet connection, you can install C/C++ compilers, Python interpreters, lightweight servers, and networking tools that you would normally only use on a PC.
If you're starting out with languages like C++, Python, HTML, or CSS, Termux lets you move from theory to practiceInstead of just watching videos and reading notes, you can write your code, run it on your mobile device, and experiment with small projects that approximate real-world scenarios.
Furthermore, the Termux ecosystem fits very well with the way cybersecurity, process automation, and systems administration work, where they are used Python scripts, network tools, and Linux commands continuously. Turning your phone into a portable mini-lab is a great way to train those habits from day one.
Install and configure Termux on your Android tablet or mobile device
Before you start writing code, you need to get Termux more or less fine-tuned. The first thing is to get the app from a reliable and up-to-date sourceThe recommended option is usually the official F-Droid repository or the Termux GitHub page, where they upload the latest versions compatible with the latest Android APIs.
Once the application is installed, open Termux and let it prepare the initial environment. You will see a typical shell prompt. The next logical step is update the system's basic packages to avoid being stuck with outdated versions. In Termux, this is done using the usual commands of the manager itself:
pkg update && pkg upgrade This is what you'll use to download new indexes and update everything you have installed. It's a step you should repeat from time to time, especially before installing compilers, Python, or development tools, because it prevents version conflicts.
With the system up to date, you'll be interested in installing some basic terminal utilitiesThese often include editors like nano or vim, file decompression tools, network utilities, and other extras to make your daily life easier. Nano is usually the simplest option if you're starting out, because it uses simple shortcuts and displays help at the bottom of the screen.
At this point, you already have a mini Linux running on your Android device, ready to add compilers, interpreters, and anything else you need to program in C, C++, and Python from the terminal. You don't need to be a systems expert: you'll gradually become more comfortable with the basic commands as you write your first programs.
Install clang and compile C and C++ with Termux
To program in C and C++ from Termux you need a compiler that understands both languagesIn this environment, the clang package is commonly used, which includes the necessary support for C and C++ and also creates shortcuts to gcc and g++ compatible executables so you can compile with classic commands.
Installation is straightforward: in a new Termux session, run the command pkg install clangThe tool will ask for confirmation; simply answer with Y when prompted. The package manager will download all the necessary components and install them on your system. From that point on, you will have the executables available to compile in C (gcc) and C++ (g++).
With clang installed, what you're getting is a Complete build environment for C and C++ on AndroidYou can write source code, compile it, and generate executables that run directly within Termux. It's virtually the same as what you would do on a desktop Linux system, but adapted for mobile phones or tablets.
If at any point you encounter errors due to missing dependencies or libraries, installing the necessary software will probably suffice. specific add-on packages from within the Termux manager itself. Don't worry: in most cases, it will be a matter of reading the error message, finding the library name, and adding the corresponding package.
This framework allows you to compile everything from simple programs to more complex projects, as long as they don't rely on heavy graphical interfaces or other components not supported by Android. It's more than enough to learn C and C++ logic and practice data structures, algorithms, and small console utilities.
First C program from your tablet with Termux

Once you have the compiler, it's time to try it out with a simple example. Typically, you'll create a Write a "Hello world" program in C to verify that everything works.The first step is to choose an editor. Nano is usually the most convenient option if you're just starting out, and you can easily install it with:
pkg install nano This is the command that adds the editor to the Termux environment. Once the installation is complete, you can create a new file with a name like hola.c by running nano hello.c in the terminal. This will open an empty buffer where you can type any C code you want.
Inside the file, write a simple C program that prints a message to the screen. You don't need to stick to the classic example; any text will do to verify that compilation and execution work correctly. The important thing is that it contains the `main` function and a call to `printf`, because it is the basic structure of a C program.
When you finish writing, you need to save the file. With nano, the process involves using the key combination. CTRL + O to write the file, press Enter to confirm the name, and then CTRL + X to exit From the editor. You will return to the Termux prompt with your hola.c file saved in the current directory.
The next step is to compile. From the same directory where hola.c is located, use the C compiler by running something like gcc -o hello hello.cThis command tells the compiler to generate an executable called hola from the source code hola.c. If everything is correct, no error messages will appear and you will see the prompt return silently.
From there, you just need to run the generated file with ./hello to see the programmed message in the terminal. With this, you have already demonstrated that you can Write, compile, and run C programs directly on your Android device. using Termux, without the need for a desktop computer.
Compile and run C++ code in Termux with g++
For C++ the idea is very similar, but using the g++ executable that is part of the clang packageC++ greatly expands the possibilities of the language compared to C, with object-oriented programming, templates, richer standard libraries, and more. In Termux, you can practice all of this using the same terminal.
In some cases, the C++ compiler can compile pure C code, although it will usually display some warning. For example, you could use the command g++ -o hola_cpp hola.c To generate an executable from the same C file. The compiler will warn you that you are mixing things, but it will still create a binary called hola_cpp that you can run with ./hola_cpp.
Even so, it is recommended that for Real-world C++ projects use files with the .cpp extension and code designed for C++Taking advantage of its own characteristics. That way you can get the most out of the classes, the standard library, and the language's modern tools without being limited by C.
As with C, the workflow is the same: you create a source file (for example, program.cpp), edit it with nano or your preferred editor, save the changes, and then compile it with g++, specifying the name of the output executable. If warnings or errors arise, Termux will display them in the terminal so you can correct the code.
With this approach you can start building small C++ programs from your tabletFrom basic exercises to practice structures, to mini utilities that automate tasks within Termux itself, such as processing text files, analyzing logs, or generating simple reports in the console.
Install and use Python in Termux for real-world projects
Besides C and C++, Termux shines when you work with Python. With just a few commands, you can turn your mobile phone into a scripting and automation lab that goes with you everywhere. To install the interpreter, simply use your usual package manager.
The command you need is pkg install pythonThis will download the Python version available in the Termux repositories, along with the essential libraries to get started. After installation, the interpreter will be accessible from the terminal simply by typing python or python3, depending on the default alias.
With Python up and running, you can start creating scripts and small projects. One of the best ways to learn is to follow a series based on practical projects that you can run and modify directly on your deviceInstead of just focusing on isolated examples, you approach each topic with a clear objective: to automate something, analyze information, or interact with external services.
A very interesting approach involves mixing Linux commands with Python scripts, taking advantage of the fact that Termux gives you network tools, system utilities, and file system access and options for manage wakelocks and batteryIn this way, each program you create in Python solves a specific problem, while also forcing you to think about how to fit the logic of the language with the possibilities of the terminal environment.
With this scheme, Termux ceases to be just a curious app and becomes a study companion: any spare moment is enough to open the terminal, write some code and test a new idea without needing another device.
Useful Python project ideas in Termux
To prevent Python from becoming just a list of functions and loops, it's great to design projects that closely resemble real-world situations. Termux offers plenty of opportunities for this, especially in areas like Basic cybersecurity, automation of repetitive tasks, and information analysis.
One first idea is to create a script of network check automationFor example, a program that pings multiple sites, logs their responses, and notifies you if any fail. You can use modules like subprocesses, sockets, or specific libraries to handle connections. This way, you practice issuing external commands, capturing output, and handling errors without crashing the script.
Another very practical project is a simple password strength checkerHere you can write a script that takes a password, analyzes its length, the use of uppercase and lowercase letters, numbers, and symbols, and returns a score. If you're feeling adventurous, you can add regular expressions or compare it to lists of common words that you generate and manage from Termux.
You can also mess with the log file analysisWhether from services you set up in Termux or from other systems you transfer to your mobile device, the goal would be to read the file, filter lines with specific information (errors, alerts, specific IPs), generate summaries or reports, and, if you want to go further, detect patterns that might be of interest for security or maintenance.
One project that tends to be quite engaging is making a simple web scraperBy leveraging libraries like requests and an HTML parser, you can create a script that visits specific pages, collects data, and saves it for later analysis. This can be useful for tracking prices, gathering public information, observing changes on websites of interest, or even training your eyes to detect suspicious content or social engineering attempts.
Finally, it is very educational to create a real-time tracker of data such as weather or cryptocurrenciesUsing public APIs, your script periodically queries the information and displays it in the Termux terminal, or saves it to files for historical comparisons. Working with APIs requires you to handle HTTP requests, JSON responses, token authentication, and basic network error management.
Learn Python and cybersecurity at the same time from your mobile phone
Many of the projects you can do with Python in Termux naturally lend themselves to introducing concepts from cybersecurity and best practicesThe idea is not to turn your mobile phone into a multi-tool hacking tool, but to understand how your scripts relate to the security of networks, systems, and data.
When you build, for example, a tool to evaluate passwords, you have the perfect excuse to talk about corporate security policies, proper credential management, and frameworks such as the NIST CSF or standards like NIS2, which set obligations in certain sectors. Even if you're programming as a hobbyist, these concepts give you real-world context.
In the case of log analyzers, your script can function as a mini incident detection system It looks for anomalous patterns, failed login attempts, or unusual behavior. Again, this connects to how security teams are organized in companies, and it helps you think in terms of continuous monitoring and incident response.
Working with scrapers and APIs also forces you to consider things like the responsible use of information, respect for terms of service, and handling of personal dataIt's a good time to introduce basic ethical practices: don't overload services with requests, don't collect sensitive data without permission, and protect any credentials you use in your scripts.
If you're also interested in automating processes in a professional environment, Termux and Python can be the first step to then take those ideas to cloud platforms like AWS or Azure, or integrate them with business intelligence solutions like Power BIwhere large volumes of data and more complex workflows are handled, and also for local tasks such as schedule periodic reboots Of the device.
Basic configuration and tips to improve your Termux environment
Termux works right out of the box, but with a few tweaks you can create a more comfortable environment for scheduling for hours. To begin, it's advisable that configure an editor that you are comfortable withNano is simple, but if you already have experience with Vim or similar programs, you can install and customize it with your usual shortcuts.
Another useful tip is to organize a clear folder structure for your projectsFor example, one directory for C, another for C++, another for Python, and within each of those, subfolders for each project. This will prevent you from mixing source code, executables, and data, and will get you used to working in an organized way from the start.
If you're going to be dealing with networking, APIs, or external services, consider using a VPN on your Android device when working with TermuxIt's not mandatory, but it adds a useful layer of privacy and security, especially if you're on public or unreliable Wi-Fi networks. Also, if you want to save resources, learn how to automate turning your mobile phone on and off.
It's also recommended that you get used to writing Logging and exception handling in your Python scriptsInstead of the program crashing at the first exception, it catches network, data format, or permission errors and logs what happened. This forces you to design more robust code and teaches you to think in terms of resilience.
Finally, don't forget that Termux is a real Linux environment, so everything you learn here—commands, permissions, directory structure, pipes, redirections—will be useful later on servers, virtual machines, or production systems. It's a very practical way to familiarize yourself with the terminal while working on projects you enjoy.
Integrating Termux and Python with IDEs in Android
A fairly common question when starting with Termux is whether it's possible Connecting the Termux Python environment to a "serious" IDE on AndroidThe idea would be to have the interpreter running within Termux but editing and executing the code from a more user-friendly interface, similar to using a desktop IDE.
On Android there are applications like Pydroid or similar that include their own interpreter and allow programming with a graphical interface, but in those cases the The runtime environment is isolated from Termux.They don't share packages or configuration, and each app runs independently. Therefore, if you want an IDE that uses Termux's Python exactly, things get complicated.
Currently, the options for having a The IDE fully integrated with the Termux Python environment is limitedWhat you can do is approximate that flow using powerful editors that run within Termux (such as Vim or Neovim with plugins) or by combining Termux with external editors that access shared files, although you will still execute the code from the terminal.
Another alternative is to connect your device to a computer and work with a Remote IDE that communicates with TermuxBut that already implies moving beyond the idea of "just the mobile phone or tablet." For purely mobile use, the most realistic approach is to accept that Termux is terminal-based and enhance it with good configuration, aliases, keyboard shortcuts, and a flexible editor within the environment itself.
If your main goal is to learn Python thoroughly and apply what you learn to real-world projects, Termux gives you everything you need. And if you later want to move to more complete IDEs, you can replicate much of your setup on a PC or in a cloud environment while maintaining your existing setup. the same working logic that you have already practiced in Android.
Using a modest mobile phone or tablet, an environment like Termux, and the right tools, you can set up a more than decent workspace to learn C, C++, and Python, mix Linux commands with practical scripts, experiment with networks, logs, and APIs, and gradually understand how all of this fits into the world of cybersecurity, process automation, and professional cloud services. With some consistency, this pocket-sized lab becomes the first step towards more serious projects, and as your knowledge grows, you can take the same ideas to servers, enterprise applications, or business intelligence solutions without changing your mindset, only your scale.