Ads Here

Sunday 4 March 2018

Run Linux commands on Android

Now a day, almost everyone use Android smartphone. Now, in this post we discuss how to run/practice basic linux commands on you Android phone, and in upcoming posts we also discuss about how to write, compile and run C & C++, same like linux on your android device. Here we do all this this using an app called Termux. So, let's start - 
1. Download Termux app from Play Store. For download the link given below. 

Download

2. Open the app and with until it complete the setup. After that you see this kind of interface. 
So, this is you linux terminal in android. Now, you are ready to run basic linux commands. Now, always remember that you have to run all the commands in lower case. If you write them in upper case, then they may not run. So, let's try some of them - 
1. PWD(Present Writing Directory):
As we know for know current or present directory we use pwd command. When we execute this command it will show us our present directory. So, let's try, simply type pwd and touch the enter key. 
So, as you can see when we execute this command it show our present directory. 
2. CD(Change Directory):
For change the directory we use cd path. For goto one directory back we use cd ..
Let's try this - 
So, after execution of cd .. for know our current directory we run pwd, let's see - 
So, as you can see the directory is just one step backed. Similarly, we can go to root by executing cd /. 
3. LS: For know what files are available in a present directory we use ls. This command show the list of all files in the directory where you are in. Now, we are in files directory. So, let's try this - 
So, as you can see under the files directory we have home and usr. You can try this with other directory locations.
For view all files in more details, means size, last date of modified, it's permission etc we use ls -l. So, let's try - 
So, you can see above that the all the files listed with more details. 
4. MKDIR(Make Directory):
For create new directory we use mkdir. Now, first we goto the home directory using cd home. Now, we create a new directory named learnworld. Let's see - 
After executing this command for view is the directory created or not we run ls command - 
So, as you can see a new directory is created named learnworld. 
5. RMDIR(Remove Directory):
For remove directory we use rmdir. Now, suppose we have to directory movies  & learnworld in home. 
Now, we remove movies directory by executing this command rmdir movies. 
After execution of this command if we run ls command it will show one directory. 
So, you can see this in above picture. 
6. Clear:
Now, running some commands your screen may be get some messy. So, for clear them type clear command. 
7. Exit:
For exit the Termux, you can try exit command. After executing this command press enter again it will close Termux. 
This are some of commands. You try more commands by yourself. You can try an app called Linux Commands Handbook. In this app you find lots of linux commands, download link of the app given below.

Download Linux Commands Handbook

So, this is for now, in upcoming posts we start coding C in Termux by installing Compiler package and text editor, don't forget to share, thank you. 


No comments:

Post a Comment