Termux Ubuntu : Install and Run Ubuntu Shell in Termux

Hey Guys, It's me SaadMaqsood 🙋🏻‍♂️, And while using termux I sometimes want to try the different flavors of OS, this was the reason I wrote a post on how you can Install and Run Kali Linux Shell in Termux🔥. Since we have tried Kali Linux on termux, we should also see how ubuntu feels in termux. Using different os in termux gives you a new enjoyment to work with so even if you mess up something, your termux will still be the same. So keep reading and I am going to tell you how you can easily install ubuntu in termux and use it to learn more about it.📱🔥


Termux Ubuntu: What is the use of Termux Ubuntu?

Well, the first reason to use termux ubuntu shell is to experience and get familiar with the Ubuntu environment. If you have never used ubuntu then you should at least get familiar with it because most of the corporate sectors use ubuntu for privacy. Ubuntu also has its own package manager "apt-get" which we also use sometimes in termux. By using the Ubuntu version of CLI you will get to know a lot more about Linux and even understand the file structure. If some tool works in ubuntu and doesn't work in termux, try running it with Termux Ubuntu shell and it will work fine.


While using termux we install the best available tools for our termux and everything works perfectly until we install some broken tool that messes up all the settings and files of our termux that we cannot recover. With the use of Termux Ubuntu or Termux Kali Linux shell, you can avoid those kinds of issues because if anything messes up inside the termux ubuntu shell then it's only going to affect that container and not the entire file system or bash files of termux. You can use termux shell for your main workspace and for experiments you can use ubuntu shell. 


Install Ubuntu Shell in Termux :

If you are in a hurry, then you can just copy-paste the below command, and it will be installed in your termux application.

Step 1: (Update termux):

Before installing any tool in termux first we will update all the Pre-installed packages in termux, so we won't face any errors while using the tool.
apt-get update && apt-get upgrade -y

This command will update all the preinstalled packages in termux.


Step 2: (Install wget proot and git):

To install the tools and repos from the internet we have to install a few packages. we will install wget to get the scripts and a few files from the internet. we will install proot in termux to create a separate container environment for our ubuntu os. and lastly we will install git in termux so that we can get the project files from GitHub. just copy and paste the below commands to install them. 
apt-get install wget proot git -y

 If you have decent internet, these packages will be installed in a few seconds.


Step 3: (Go to HOME folder in Termux):

This is going to be a really important tool and to make it all work with my configuration you have to install termux shell in the home directory of the termux, just paste the below command and you will be in your home directory. 
cd

You just have to type "cd" and press enter and you will be in the /home folder of the termux.


Step 4: (Fetch the script from the github):

This command will clone the termux ubuntu shell from the github to your termux terminal. simple copy paste the command and press enter. This is a really small project so it won't take any time at all. It will be downloaded almost instantly.
git clone https://github.com/MFDGaming/ubuntu-in-termux.git


Step 5: (Go to the script directory):

Now if you "ls" your terminal, you will have a new folder name ubuntu-in-termux, you have to get inside that folder to run the installation script. just paste the below command and you will be inside the ubuntu-in-termux folder. 
cd ubuntu-in-termux


Step 6: (Give execution permission to the script):

To give this file execution permissions you have to run chmod command, this will allow the script to install the ubuntu shell in your termux terminal. run this command.
chmod +x ubuntu.sh

 

Step 7: (Execute the script):

Execute the installation script, this will install the ubuntu shell in your termux terminal. enter this command and wait for the script completely install. 
./ubuntu.sh -y


Step 8: (start ubuntu shell):

Everything is done, and now you can enter into your ubuntu shell, just type the below command and you will see that you are in ubuntu as a root user.
./startubuntu.sh

So now what you will see is the ubuntu shell, but you won't see any difference other than the prompt. To make it look better, you need to customize the shell.


Run and Customize Ubuntu shell in Termux:

These are the few customizations that you can do to kick start your journey of exploring Ubuntu shell.

Run Ubuntu shell in Termux:

If you restart your termux and you want to run the ubuntu again you have to first change your working directory to the ubuntu-in-termux folder, and then you have to run the startubuntu.sh file. so you have to execute below two commands. 
cd ubuntu-in-termux

 ./startubuntu.sh

This is a fine way to enter your ubuntu shell but that is not the only way.

 

Shortcut to Run Ubuntu shell in Termux:

To create a shortcut for ubuntu shell you can just paste the below command once in your termux terminal and after restarting whenever you will type "ubuntu" in your termux shell your Ubuntu shell will be started immediately. You can also edit the green part in the command to whatever alias you want.

echo "alias ubuntu='cd && cd ubuntu-in-termux && ./startubuntu.sh'" >> /data/data/com.termux/files/usr/etc/bash.bashrc 


Install Neofetch in Ubuntu shell:

We all know that one of the most useful intro screen in termux is neofetch. And whenever I install any flavor of linux in my system I always first install neofetch in it to get the feel of the OS. To install anything in ubuntu you have to use apt-get command. 

apt-get install neofetch

make sure you apt-get update and apt-get upgrade first so you don't face any issues.



If you want this Neofetch to always show up, whenever you open the ubuntu shell then paste the bellow command in ubuntu shell and restart it. 

echo 'neofetch' >> /etc/bash.bashrc

You can try installing new packages and customizing this one as much as you like. 


Conclusion:

Termux Ubuntu shell is the best way to explore other types of linux distributions in just a few seconds of work. I personally love how you can have a virtual sort of terminal in a simulated terminal environment. Not everyone is a big fan of ubuntu so here is the same post but for kali linux Termux Kali Linux : Install and Run Kali Linux Shell in Termux ]. You can do whatever you want in the shell and if you mess up somewhere, try to fix it or just delete the repository and it will be gone with no errors in your termux. If you have any comments or suggestions then use the comment section. thanks for reading guys, and as always, Stay Ethical 👾.

Post a Comment

0 Comments