What Is Linux?

Linux is an operating system’s kernel. Linux is free and open-source, which means that you no need to pay for anything and can change anything in Linux. Some Linux Operation systems.

Ubuntu Linux Red Hat Enterprise Linux Linux Mint Debian Fedora   Linux is Mainly used in servers and software development. Linux Shell or “Terminal” A shell is a program that receives commands from the user and gives it to the OS to process, and it shows the output. It’s the main part of Linux. Linux has a CLI (command-line interface). In this blog, we are going to learn the basic commands that we use in the shell of Linux.   How can I Open the terminal?   In Ubuntu 16.04  Press


There is another way to open the terminal is.   In Ubuntu 16.04 you have a list of install applications left side on your screen. Click on the terminal.    


 OR   Go to search option at the top left of your screen, and type “terminal”. A list of the applications comes on the screen. Select the terminal.  


Now you are ready to use terminal.

Let’s start using the commands on the Linux terminal.    

1) $pwd:- 

When you first open the terminal, you are in the home directory of your user. To know which directory you are in, you can use the “pwd” command. It gives us the absolute path, which means the path that starts from the root. The root is the base of the Linux file system. It is denoted by a forward slash( / ). The user directory is usually something like “/home/username”.  


Basic Linux Commands

  2) ls:- 

Use the “Is” command to know what files are in the directory you are in. You can see all the hidden files by using the command “ls -a“.  


Basic Linux Commands

  3) cd:-

Use the “cd” command to go to a directory.  

$cd Downloads

Basic Linux Commands

For example, if you are in the home directory, and you want to go to the downloads directory or another directory, then you can type in “cd Downloads“. Remember, this command is case sensitive, and you have to type in the name of the folder exactly as it is.

If you just type “cd” and press enter, it takes you back to the home directory.    $cd  

To go back from a folder to the folder before that, you can type “cd ..”. The two dots represent back.   $cd ..  

Basic Linux Commands

4) mkdir & rmdir:-  

Use the mkdir command when you need to create a folder or a directory.   For example, if you want to make a directory called “test_dir“, then you can type “mkdir test_dir”.   Let’s suppose I am in “linux_blog” directory. If I want to create a new directory “test_dir“. I use this command.
$mkdir “test_dir”

Basic Linux Commands
Basic Linux Commands

You can check by using “ls” command as we discussed above.  
Use rmdir to delete a directory. But rmdir can only be used to delete an empty directory.      

5) rm:-  Use the rm command to delete files and directories. But rm cannot simply delete a directory. Use “rm -r” to delete a directory. In this case, it deletes both the folder and the files in it. -r is an option to delete (recursive files ) child files. $rm -r test_dir    6) touch:- The touch command is used to create a file. It can be anything, from an empty text file to an empty zip file. For example, “touch test.txt“.  

$touch <file name >$tiuch test.text

Basic Linux Commands

you can check the file is created or not by using ls command. $ls  

7) man & –help:- To know more about command and how to use it, use the man command. It shows the manual pages of the command. For example, “man ls” shows the manual pages of the ls command. Typing in the command name and the argument helps it show which ways the command can be used (e.g., ls –help).  

$ man ls

Basic Linux Commands
Basic Linux Commands

8) cp:- 

Use the cp command to copy files through the command line. It takes two arguments: The first is the location of the file to be copied, the second is where to copy.  

$cp <source> <destination >   

Example:- I have a file test.txt inside the “Home” directory, and I want to copy that file into the “Documents/linux_blog” directory, then.
I am in Home directory location  
$cp test.txt /home/<username>/Documents/linux_blog                                  OR
$cp /home/<username>/test.txt /home/<username>/Documents/linux_blog

This command work for the only file not for the directory which has some child files.   if you want to copy directory we use “-r”option after cp command. $cp -r <source directory> <destination >”test” is a directory.    
$cp -r test /home/<username>/Documents/linux_blog                                        OR
$cp -r /home/<username>/test /home/<username>/Documents/linux_blog  

9) mv:-

Use the mv command to move files through the command line.
It takes the two arguments, just like the cp command.   For move the file.

$mv <source file> <destination > For move the directory.  
$mv -r <source directory> <destination > We can also use the mv command to rename a file.

For example, if we want to rename the file “test” to “new_test” we can use “mv test new_test“.

$mv <old file name> <new file name> 
$mv test new_test 

10) locate:- 

The locate command is used to locate a file in a Linux system, just like the search command in Windows. This command is useful when you don’t know where a file is saved or the actual name of the file.

$locate “<file name>”
$locate “test.txt”

Using the -i argument with the command helps to ignore the case (it doesn’t matter if it is uppercase or lowercase).
So, if you want a file that has the word “hello”, it gives the list of all the files in your Linux system containing the word “hello” when you type in “locate -i hello“.

$locate -i “<file name>”
$locate -i “hello
You can separate them using an asterisk (*).

For example, to locate a file containing the words “hello” and “this”, you can use the command “locate -i *hello*this”.$locate -i “<word1>*<word2>”

Thanks For Reading …

Leave a Reply

Your email address will not be published. Required fields are marked *