Basic Linux Commands For Beginners | With Example

Hi,

If you’re getting started with Linux and looking for the best way to learn Basic Linux Commands with live examples, this is going to be the best article for you. Nowadays, when every second or third person has their own website, Learning Linux Commands has somewhere become a necessary task for us.

PuTTY, is nothing but software like a command prompt to execute Linux commands. It’s an open-source, entirely free windows software that you can easily install from their official website. It supports several network protocols such as SSH, SCP, Telnet, rLogin, Etc. The right way to pronounce PuTTY is ‘Patti’and it has no official meaning.

PuTTY is just software to execute Linux Commands using a variety of protocols which doesn’t mean that you cannot execute PuTTY commands in your Command Terminal. However, there might be some limitations of command, as PuTTY is basically used to establish a secure connection between two computers using various secure protocols such as SSH and SFTP. 

basic linux commands for beginners with example
basic Linux commands for beginners with example

If you have the knowledge of basic Linux Commands, you can skip the first heading of this post and directly jump to the advanced Linux commands. If not, follow the below tutorial to learn basic Linux Commands. In this article, we’re gonna walk you through the complete list of the most popular and most used Linux commands that every beginner should see before getting into the Linux industry. So, without wasting a time, let’s dive right in!!

Linux Basic Commands

Below, I’m mentioning the list of all the basic Linux commands that would be enough to get into the Linux industry. Open your command terminal, or log into the PuTTY or any other SSH-client software if you’re a Web Hosting user.

1. PWD

2. ls

3. cd

4. mkdir rmdir

5. rm

6. touch

7. find

8. cp

9. mv

10. cat

11. nano vi

12. df

13. du

14. zip/unzip

15. uname

16. tar

17. chmod

18. ping

19. top

20. exit


20 Basic Linux Commands with Live Example

Following are the top 20 basic Linux Commands with Live Examples that would definitely help you start your Linux journey.

  1. pwd:  Once you open the terminal, the first command you should use is PWDThe PWD Command is used to display your current working directory. pwd command

  2. ls:  The ls command in Linux will help you to list all the content present inside your current working directory. You can also list all the hidden files in PWD with the ls -a command.ls command in linux

  3. cd:  The cd command in Linux is used to browse through the directory. It’s like the handle of your bike. You can go anywhere you want on your server using the cd command. Suppose you opened a Linux terminal and executed the first pwd command. It’ll show you where you are. Now, you entered the ls command to list all the directories. Now you want to move inside another directory to see what’s in it. There you can use the cd DirectoryName command to browse into the directory.cd linux command

  4. mkdir/rmdir:  The mkdir command in Linux is used to create directory/directories, whereas the rmdir is used to remove a directory. However, you can only remove empty directories using the rmdir command. Use the rm command to delete a directory filled with content.mkdir linux command

  5. rm:  The rm -r command in Linux is used to remove directories containing files. If you want to delete any duplicate or unused directory from your server, simply type the rm -r DirectoryName command and hit enter. Other than this, you can use the rm -rf command to forcefully delete the directory without asking any further questions. It’s like you’re entirely sure to delete that directory and don’t want any kind of confirmation.rm command in Linuxrm -rf command in Linux

  6. touch:  You just learned to create and remove directories in Linux. But what about the files? Well, you can use the touch command to create files. Although, you can use the same rm -rf command to remove files.touch command in Linux

  7. find:  If the list of files and directories in your server is high, you’ll struggle to find a specific file. Luckily, Linux has provided us a command by which you can easily find any specific file or directory located in your current working directory. Type the find filename or find DirName command and hit enter. (Change filename and DirName with your custom file/directory name).find command in linux

  8. cp:  The cp command in Linux is used to copy files/directories from one directory to another. Simply type cp FileName usr/subdir/destination or type cp DirName DestinationDir. (Again, do not forget to type your own path instead of the dummy path).cp command in linux

  9. mv:  The mv command is used to simply rename files. Type mv filename.exe NewName.exe command, and hit the enter button to rename a file.mv command in Linux

  10. cat:  This command is used to view the contents of a file. Simply type cat filename.extension and hit the Enter button. However, you can only view the contents but not modify them. If you want to modify the contents of a file, then you can use the vi or nano command.
    cat command in Linux
    cat command in Linux

  11. vi & nano:  Both of the commands are used to modify the contents of a file. You can either type vi filename.php or nano filename.php to view the contents of a file and type to start editing the file.vi command in Linux

  12. df: This command will display the available & used disk space of every partition in your system. You can simply type the df and hit enter to see the result.df command in Linux

  13. du:  The du command can be used to track files and directories that are consuming a high amount of disk space on your server’s hard disk.du command in Linux

  14. zip/unzip:  To compress a file or files into a zip format, use the zip command. Whereas, you can use the unzip command to extract the zip files. Type the syntax zip filename.zip file1.php file2.php
    zip command in Linux
    Zip Command
    unzip command in Linux
    Unzip command

     


  15. uname: The uname command is used to display the information about the operating system your server using. You can use the uname -a command to display most of the server information such as operating system, kernel release date, hostname, processor type, version, etc.uname command in Linux

  16.   tar:  You can use the tar command to create compressed or uncompressed Archive files and also maintain and modify them. Simply hit the
    • Use the tar -cvf filename.tar Dir1 Dir2 Di3 command and hit the enter button to compress all the directories into a tar file.
    • tar command in LinuxAlso, use the tar -xvf filename.tar command to untar/extract.

  17. chmod:  The chmod command is used to change the files/directories permissions. This command is quite sensitive. So, I’ll recommend not to use this command if you don’t have any knowledge about Linux Permissions. However, to change the permissions of a file or directory, you can use the chmod permission filename.php command. See the below image to get a clear understanding.chmod command in Linux

  18. ping:  This command is used to troubleshoot the connectivity and reachability of the domain or server. It’s usually the first diagnostic step most users take when the website or server doesn’t respond.ping command in Linux

  19. top:  If you want to display a real-time view of all the processes running, type the top command and hit enter.top command in Linux

  20. exit:  The exit command is used to close and exit from the terminal.

Other Popular Linux Tips & Tricks

Here are some useful Linux shortcut keys that you should know to easy finish every task.

  • You can type clear and hit enter to clear the terminal window if it’s filled with commands.
  • If you’re editing a file using the vi command and struggling to save the file and exit from the editing section, press Esc from your keyboard, then type :wq! command, and hit the enter button to Save the file and Exit from the editing window.
  • You can press ( ↑ ) the upper arrow button to reveal all the recent commands you’ve executed previously.
  • If you’re not able to reboot or power off your desktop, you can use sudo halt and sudo reboot command to power off or reboot your computer.
  • You can press Ctrl + C from your keyboard to stop any in between. Other than this, the Ctrl + Z command is used to forcefully stop the command execution. This command could be helpful to stop several commands, and the ping command is one of them.
  • In some cases, you can also type q to stop the running command. For instance, you can stop the top command by pressing from your keyboard.
  • The history command is used to display the history of commands you recently executed. you can type history 10 to display 10 recent commands. The history command can display a maximum of 100 recent commands.

I hope this article helps you, if it doesn’t, you can simply hit the comment section and mention your queries. I would love to hear from you guys. And, if this helps you anyhow, Share this post with your friends & follow us on Facebook & Twitter to stay updated with any other articles.

Moreover, if you want to start your carrier as a Web Hosting Provider, you can start your journey with the cheapest Linux hosting provider across the Internet.

Have a great day ahead.

Scroll to Top