feature image of basic command for linux

Getting Started With Basic Command for Linux

Hey Linux user, Do you know that this post is going to very interesting for you? People are afraid of using Linux because they think that Linux-based operating systems like Ubuntu, Fedora, Mint, Kali, etc that are also known as Linux distributions or distros are only made for programmers. In this post, I am going to give you the basic command for Linux which you can learn today, and start applying in your Linux terminal for better productivity.

Linux can use anyone because there are lots of changes is done in the Linux Operating System. GUI has improved a lot. It is also a very lightweight, fast, and Open Source operating system.

I have told in my previous post that if you want to do development works then you have to master the terminal.

It doesn’t matter either you are writing your code in the favorite text editor or you want to push the code in GitHub. You must have knowledge about how to use the terminal.

If the command prompt is your friend then you can do every task very easily.

Okay, too much gibberish from, now coming to the point let’s start the topic.

How to open Terminal in Linux

Before learning the command for the Linux terminal, first, you should know how to open the terminal in Linux.

Follow the below method to open the terminal:-

Method 1:

  1. Press the Ctrl+Alt+T altogether to open the terminal.
  2. After pressing the above key you will see something like this.

Method 2

  1. Press the Window button on your keyboard. It will open the search bar.
  2. Type terminal in the search bar then it will give the terminal click on it.

Follow any one method and you are good to go. Read till the end, practice, and enjoy the code on your terminal.

Also Read: [ Basic Command Prompt Commands for Windows 10 ]

Useful Command for Linux Operating System

“ls”

This command is very helpful because it is used to list all the directories in a particular folder. Most of the time you will use this command and the “pwd” command in your life. Once again I am saying that don’t forget it.

Note: Directory means simply folder

“pwd”

The pwd is the short form of the present working directory. This means the directory in which you are currently working. It is very beneficial to know sometimes the directory in which you are currently working.

I do web development and from my experience, I can tell you that if you know the path of the directory then you can very easily give this path to any program.

basic command for linux pwd and ls
pwd and ls command

“cd”

The cd command is used to move between directories. Suppose you want to go in the “test” directory then you will simply type cd test. 

It is very important to know this command because you will use this most often to switch between directories.

basic command for linux cd
cd command

“cd ..”

.. means parent directory, and cd means change directory. If you want to go up level up in the parent directory. Then simply fire this command and you are now in the parent directory.

.. and . are the concepts of absolute and relative path names. If you really want to learn this concept then click on this link. [ Absolute and Relative path names ]

“clear”

The clear command is used to clear the terminal. If you have written so much code on the terminal it is the best time to run this command.

“cd /”

The “cd /” command will take you to the root directory where all your os files are stored. Look don’t delete any files from the root directory but if you know what you are doing and there is not any harm in doing this then you can do it.

cd command to go into the root directory
“cd /” command

“cd ~” or “cd”

No matter in which directory you are currently working but if you want to go into the user directory or home directory then you can use this code in your terminal to check.

cd command to go into the user directory.
cd ~ command

mkdir folder_name

Suppose you want to make name test2, then simply type mkdir test2 and your folder has been created in the directory from where you fired this command.

The full form of mkdir is make directory.

You can see the below image for a better understandng.

mkdir command is used to create folder or directories
mkdir command

touch <filename.extension>

If you want to create a file of any extension because you will not always use the text file. Then simply type touch index.html

mv <old_file_name> <new_file_name>

mv command is used to rename the name of the file. Suppose in the above example you created the file name index.html and for any reason, You want to change the name of the file.

Then you have to simply type mv index.html index2.html.

See the below image for a better understanding.

mv command is used to rename the file.
mv command

rm <file_name>

You can also delete the file by simply running the one-line command. Look all these commands which I am teaching you in this post are basic, all you need to do is to grab it and practice it on the daily basis.

Run this command rm index2.html to delete the file.

rm command is used to delete the files.
rm command

rm -r <folder_name>

And lastly, if you want to delete the folder completely from your computer then run this command.

All you need to do is to type rm -r test2, then it will completely delete the folder name test2.

See the below screenshots for a better understanding.

this command is used to delete the folder.
rm -r <foldername> command

Author Advice

There are numerous of basic Linux command available to learn. But my aim was from this post to getting start with the terminal. Because terminal is something you will use mostly in you daily life.

It doesn’t matter whether you are cs student who is preparing for a product-based company or those who are making their personal projects in the development field. I think using a terminal makes you cool because it is something that most people are not doing and you are doing something that is having great demand in the industry and along the way you are also improving your technical skills.

If you want to read more advance command of Linux then read this article.

If you like this article then please share it with your fellows. Sharing will not take much time but It will help me to write more valuable content and help people.

Leave a Comment

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