We mostly use our phones in “app mode.” We tap an app and launch it in a separate window to get things done. For most people, that’s how computers work, too, because even desktops are app-centric now. However, there’s another way to control your computer or phone, and that’s with a terminal window. I’m going to try and convince you why a terminal on your phone is worth it.
Set up Termux
Termux is a terminal emulator app for Android that lets you use terminal commands in a contained Linux environment. Termux doesn’t require root access, and the emulator runs inside a sandbox, so you don’t need to worry about breaking anything on your phone. Let’s start by installing the app first. You can grab it from the Play S…
We mostly use our phones in “app mode.” We tap an app and launch it in a separate window to get things done. For most people, that’s how computers work, too, because even desktops are app-centric now. However, there’s another way to control your computer or phone, and that’s with a terminal window. I’m going to try and convince you why a terminal on your phone is worth it.
Set up Termux
Termux is a terminal emulator app for Android that lets you use terminal commands in a contained Linux environment. Termux doesn’t require root access, and the emulator runs inside a sandbox, so you don’t need to worry about breaking anything on your phone. Let’s start by installing the app first. You can grab it from the Play Store or install it from F-Droid (it’s a great repository of open source apps that don’t spy on you).
Once that’s done, open the app and that’s it. You’re now ready to run commands in Termux. Since we’ll be working with media and other types of files with Termux, I suggest you turn on storage access to follow along. Type in this command and tap Enter.
termux-setup-storage
You’ll be taken to a list of apps that request storage access. Look for Termux and switch on its storage permission. Now we’re good go.
Type the following command and hit Enter to clear the terminal screen when it gets crowded at any point.
clear
Instead of relying on sketchy adware websites and apps, you can download media from the internet with simple commands using Termux. You can use them to download videos or audio from YouTube, Twitter, Facebook, Instagram, TikTok, Pinterest, and about 1700 other websites.
We’ll use a TUI (text-based user interface) tool for this. Unlike regular apps, which present you with a graphical user interface, or a GUI, you simply type precise commands to tell the device what to do. Let me show you how it works.
Start by updating the Temux package repository.
pkg update && pkg upgrade
Press Y to confirm the installation, if asked. Next, we’ll install dependencies for the tool that lets us download the media from supported sites. It’s called YT-DLP.
pkg install python ffmpeg
Once again, press Y to confirm the installation if asked. Then type the following and tap Enter again.
pip install -U yt-dlp
Now we’ll install YT-DLP, and we can use it to download media. Typically, you can just type “yt-dlp” followed by the video’s URL and hit Enter to start downloading the video instantly. Let’s navigate to the folder we want the downloaded file to land in, and then we’ll just download it to that same folder.
Type “ls” and hit Enter to see all available folders in your current directory. It should show you “storage.”
ls
Then type “cd storage” to change the directory to storage.
cd storage
Run “ls” again to see available directories and use “cd” to jump into one. For example, I’ll be jumping into the Downloads folder.
cd downloads
Once you’re in the preferred folder, just type yt-dlp, followed by the video or audio URL. Something like this should work:
yt-dlp https://youtu.be/dQw4w9WgXcQ?si=_uuQ_uVOtp2HMk4W
Once the command fully runs, check the phone’s downloads folder and the video should be there.
This tool is incredibly powerful, and you can do a lot of cool stuff with it, like downloading in batches, choosing file formats, configuring subtitles or thumbnails, and a lot more.
Make sure you only use Yt-dlp to download fair-use or non-copyrighted material.
The installation and navigating to the right folder are one-time setups. Once you’ve created a session like that, you can save it, and the next time you just have to write “yt-dlp” and then paste in the URL of the video or audio you want to download.
Convert video and audio files
You don’t need to upload your personal video and audio files to random websites or send them to your PC just to convert them to other formats. With Termux, you can do that locally with simple commands.
Start by installing ffmpeg—the tool we’ll be using for the conversions.
pkg install ffmpeg
Once done, just make sure your Termux directory is currently the folder where the target files are. Alternatively, you can change your directory to that folder by using the change directory commands.
First, we use “ls” to list available folders in our current directory. We are in the root directory right now, so we’ll change directories to storage like so,
ls
Then,
cd storage
Let’s repeat
ls
Then let’s select your desired folder from this latest list of folders. I want to move to the Movies folder, which I’ll do by typing and entering the following command.
cd movies
Now you can convert any video or audio files in this folder. Start by typing “ffmpeg” followed by “-i” where the hyphen with the alphabet stands for input, then you enter the file name you want to convert, and finally write the file name and format you want as the output.
ffmpeg -i funny.webm converted.mp4
If the command runs without any errors, you should have the converted file in the same directory.
Make sure you have provided Termux storage access, as outlined in the setup, or this won’t work.
This setup is a one-time process, and once you’ve installed ffmpeg on Termux, you can convert as many files as you want, even in batches.
FFmpeg is also incredibly sophisticated and powerful, and the conversion demo barely scratches the surface. Yes, you can convert between pretty any media format (even GIF), but you also get advanced encoding features, audio processing controls, and even video editing features. You can extract audio from videos, normalize the audio, add audio effects, crop, trim, or rotate videos, and apply filters or overlays.
FFmpeg has extensive documentation on the official website, which I recommend checking out if you’re an editor or your workflow requires you to handle media files of any kind.
Send files and text through SSH
So far, we’ve been using our phone kind of like a regular computer. Now, imagine if we could control an actual computer like this with the command-line. That’s made possible by the Secure Shell Protocol or SSH. It’s a way to remotely control a computer in a secure way, even if the network itself is insecure.
We can use SSH to log into our PC using our phone remotely. Once that’s done, you can do everything you can typically do with a PowerShell terminal on your PC. You can look at active processes, shut down, and reboot the computer. I’ll demo how you can send files securely between your computer and phone.
You can also SSH into your phone from your PC, so it works the other way around, too, but access will be limited with an unrooted phone.
Step #1
We’ll do it in three steps. First, open Termux on your phone and enter the following command:
passwd
Here, we’ll set up a password that we’ll be entering on the PC later to establish a secure connection. Keep it simple and enter it twice.
After you’ve set up a password, let’s find out the username we’ll need to log into our phone from our PC.
whoami
The result will be the exact username.
Next, we’ll type ifconfig to get the IP address of our phone.
ifconfig
This command will return the IP address next to the WLAN tag because the phone is currently connected to Wi-Fi.
Finally, let’s install OpenSSH on Termux to complete the setup. Enter the following command and then press Y to confirm the installation.
pkg install openssh
That gives us everything we need to log into the phone from the PC.
Step #2
Let’s try logging into the phone from our computer.
On Windows, search for “optional features” in the Start menu, then look for “openssh.” Make sure the OpenSSH Client is installed.
To start the client, search for “services” in the Start menu and look for the OpenSSH Client in the list (press O to quickly jump to that alphabet in the list).
Double-click the OpenSSH SHH Server service and click Start if it’s not already running. Now we’re ready to send a file from the PC to the phone using SSH.
Step #3
Open a Terminal window by searching in the Start menu. Type “scp”, which means secure copy, “-P 8022”, which is the usual listening port, followed by the file path, then the username we found and the IP address with an “@” symbol between the two, a colon “:” symbol, and finally the download path on the phone.
scp -P 8022 G:\AndroidFiles\Test.txt u0_a323@192.168.xx.xx:/storage/emulated/0/Documents
My file paths and log-in details look like this, but you can swap them out for your own.
You’ll be asked to enter a password (it’s the same password we set at the start of this process). If the transfer is successful, the terminal should show the file name it just pushed to your phone.
We can do it the other way—ssh into the PC from the phone. The username is already displayed in the Windows terminal, and you can find the computer’s Wi-Fi by looking at network properties in the Settings. The address you’re looking for should be labeled IPv4.
To SSH into your PC from your phone:
ssh -P 8022 UsaRas@192.168.x.x
UsaRas is the PC’s username, followed by the computer’s IP address.
When you press Enter, you’ll be asked to enter a password. The password here is the password that you use to log into your computer.
Termux will drop you into the Windows PowerShell terminal on your phone, where you can remotely manage files, run automation scripts, launch programs, view system stats, shut down the PC, and a lot more. If you want to send a file from your phone to your PC, the same command-line format will work that we used before.
scp -P 8022 /storage/emulated/0/Documents/sendthisfiletopc.txt UsaRas@192.xx.xx:G:\AndroidFiles
Do a Fastfetch
You might have seen Linux users display a colorful ASCII logo of their operating system, along with the system specs. It’s done with simple tools like Neofetch or Fastfetch. You can do the same on Termux like so,
pkg install fastfetch
Press Y to confirm installation if requested.
Now simply run the command:
fastfetch
You can do so much more with a terminal window in Android. There are ways to run full-fat Linux apps, complete with a GUI (graphical user interface), in Termux. You can even run an entire GUI Linux environment just like you would on the desktop using Termux, but those setups are a bit more advanced. Once you’ve built some familiarity with Termux, I highly recommend trying those advanced setups.