Home Tech Stuff Linux Basic Commands for Beginners

Linux Basic Commands for Beginners

Hello everyone and welcome to my blog. Now in this post we’ll be covering some of the basic Linux commands. In order for you to get to know Linux better. A good way would be to start off with learning these basic commands that I will teach you right now.

Before we proceed, you will require a Ubuntu instance. If you don’t have one already, you can buy a VPS with Hostinger, GoDaddy or Bluehost at very cheap price. Deploy a fully-managed VPS or cloud server at very reasonable cost.

Linux Basic Commands for Beginners

So, to start off we just want to open up our terminal windows to run the commands

1. pwd

The first command I want to show you is pwd, which stands for print working directory. It basically just prints out the current directory that you are in, which in my case is

# sudo pwd

 

2. ls

ls command is to check sub-directories of the folder

# sudo ls

the /root directory. As we can see we have desktop, documents, downloads, music, pictures, public

 

3. ls -al

it will also print out the hidden files and hidden subdirectories as you can see, all of these files that start with a . are not seen in the ls command

# sudo ls -al


4. cd

cd stands for Change Directory. This command is used to change directory. For example cd Desktop

# sudo cd Desktop

 

5. touch

If you wanted to create a file in the directory, touch command will be used. For example ” touch sample.txt “, here we create text file by name sample which can be seen by ls command from the current Desktop directory

# sudo touch sample.txt

 

6. mkdir

make directory, and then type here the directory name you want to make. mkdir command allows you to create Dirctory, for example ” mkdir test

# sudo mkdir test

Let’s see the newly created folder and file by ls command, so subdirectories will be a different color than file, you should know that.

 

7. rm

We can delete the files / folders with rm command.

# sudo  rm sample.txt

To delete the folder simply add -r

# sudo rm -r test

Once we delete let’s ” ls ” again to see sub-directories and files, you won’t find the deleted files and folders

 

8. vim

To install vi, run “apt-get install vim” in Ubuntu. vim command allows to edit / modify the files from any directory. Let’s say ” vim sample.txt “, here we can add or delete any text, number and save the file

# sudo vi sample.txt

To edit the file, simply type ” i ” 

 to save the file type ” : ”  “escape key”  then ” wq ” and enter ( Without inverted commas )

 

9. cat

cat command is very useful in day to day activity for Linux Admin. cat command is used to display inside of the file, it basically just prints out the contents of the file on the Terminal window. For example, we will check sample.txt file

# sudo cat sample.txt

 

10. echo

So let’s continue with another command echo, basically echo you can just use it to add a word. A word into a file without opening it. For example I want to add Hello World as a word into file sample.txt

# sudo echo Hello World > sample.txt

After adding word, we can check it by cat command.

 

11. cp

cp command is used to copy files or folder from one directory to another directory

# sudo cp sample.txt  /var/www/html

The above command will copy sampe.txt file from Desktop to html folder

 

12. top

This command will show you all the current process running on your Linux Machine

# sudo top

 

13. ifconfig

If you want to check Linux Machine IP Address, simply type ” ifconfig ‘

# sudo ifconfig

 

14. netstat

The netstat command generates displays that show network status and protocol statistics. You can display the status of TCP and UDP endpoints in a table format, routing table information, and interface information.

# sudo netstat

 

15.  yum update

This command will update your Linux applications. This will take a lot of time to finish but you must do it, Not a lot of time but about an hour maybe 40 minutes I’m not really sure it depends

# sudo yum update

 

16. history

If you want to check out the history of all of the commands you typed previously in this current session of the session of terminal you can just do that with the simple command ” history ” you will see all the commands that we ran before

# sudo history

 

17. clear

Now one important command is to clear the screen so you don’t see all previous commands all the time

# sudo clear

 

18. reboot

This command will restart your Linux System.

# sudo reboot

Also ReadHow Install LAMP On Ubuntu

Video Tutorial

 

In this Post we have covered Linux Basic Commands for Beginners which we have performed on CentOS 8 Operating System. Comment below for your queries and suggestion or you can contact me any time via contact page. I will be assisting you and try my best to clear your all doubts.

LEAVE A REPLY

Please enter your comment!
Please enter your name here