Linux Basic Terminal Commands for Beginners - 2022

Linux Basic Terminal Commands #2022

In this Article we will see some linux command line and how to use them in Linux terminal | Linux Shell.

Linux is a free and open-source operating system that you can make changes to and redistribute.

Linux Basic Terminal Commands

What is linux?

Linux is an operating system's kernel. You might have heard of UNIX. Well, Linux is a UNIX clone. But it was actually created by Linus Torvalds from Scratch. Linux is free and open-source, that means that you can simply change anything in Linux and redistribute it in your own name! There are several Linux Distributions, commonly called “distros”.

  • Linux Mint
  • Ubuntu Linux
  • Debian
  • Fedora
  • Red Hat Enterprise Linux

Linux is Mainly used in servers. About 90% of the internet is powered by Linux servers. This is because Linux is fast, secure, and free! The main problem of using Windows servers are their cost. This is solved by using Linux servers. The OS that runs in about 80% of the smartphones in the world, Android, is also made from the Linux kernel. Most of the viruses in the world run on Windows, but not on Linux!

What is a Linux Commands?

A Linux command is a program or utility that runs on the CLI – a console that interacts with the system via texts and processes. It is similar to the Command Prompt application in Windows.

Linux commands are executed on Terminal by pressing Enter at the end of the line. You can run commands to perform various tasks, from package installation to user management and file manipulation.


Here’s what a Linux command’s general syntax looks like:
CommandName [option(s)] [parameter(s)]

A command may contain an option or a parameter. In some cases, it can still run without them.
These are the three most common parts of a command:

  • CommandName is the rule that you want to perform.
  • Option or flag modifies a command’s operation. To invoke it, use hyphens (–) or double hyphens (—).
  • Parameter or argument specifies any necessary information for the command.

Keep in mind that all Linux commands are case-sensitive.

Linux Shell or “Terminal”

So, basically, a shell is a program that receives commands from the user and gives it to the OS to process, and it shows the output. Linux's shell is its main part. Its distros come in GUI (graphical user interface), but basically, Linux has a CLI (command line interface). In this tutorial, we are going to cover the basic commands that we use in the shell of Linux.

linux basic terminal commands beginners

To open the terminal, press Ctrl + Alt +T in Ubuntu, or press Alt+F2, type in gnome-terminal, and press enter. In Raspberry Pi, type in lxterminal. There is also a GUI way of taking it, but this is better!

Top Linux Commands

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".

linux basic terminal commands beginners

 

2. ls : Use the "ls" 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”.

linux basic terminal commands beginners

 

use ls -l Command to display all the File and directory to their user access permissions. see the picture below

linux basic terminal commands

 

3. cd : Use the "cd" command to go to a directory. For example, if you are in the home folder, and you want to go to the downloads folder, 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. But there is a problem with these commands. Imagine you have a folder named “Raspberry Pi”. In this case, when you type in “cd Raspberry Pi”, the shell will take the second argument of the command as a different one, so you will get an error saying that the directory does not exist. Here, you can use a backward slash. That is, you can use “cd Raspberry\ Pi” in this case. Spaces are denoted like this: If you just type “cd” and press enter, it takes you to the home directory. To go back from a folder to the folder before that, you can type “cd” . The two dots represent back.

linux basic terminal 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 “DIY”, then you can type “mkdir DIY”. Remember, as told before, if you want to create a directory named “DIY Hacking”, then you can type “mkdir DIY\ Hacking”. Use rmdir to delete a directory. But rmdir can only be used to delete an empty directory. To delete a directory containing files, use rm.

linux basic terminal commands

 

5. rm : Use the rm command to delete files and directories. Use "rm -r" to delete just the directory. It deletes both the folder and the files it contains when using only the rm command. 

 

6. touch : The touch command is used to create a file. It can be anything, from an empty txt file to an empty zip file. For example, “touch new.txt”. 

 

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

 

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. 

 

9. mv : Use the mv command to move files through the command line. We can also use the mv command to rename a file. For example, if we want to rename the file “text” to “new”, we can use “mv text new”. It takes the two arguments, just like the cp command. 

 

10. ping : Use ping to check your connection to a server. Wikipedia says, "Ping is a computer network administration software utility used to test the Reachability of a host on an Internet Protocol (IP) network". Simply, when you type in, for example, “ping google.com”, it checks if it can connect to the server and come back. It measures this round-trip time and gives you the details about it. The use of this command for simple users like us is to check your internet connection. If it pings the Google server (in this case), you can confirm that your internet connection is active! 

 

11. uname : Use uname to show the information about the system your Linux distro is running. Using the command “uname -a” prints most of the information about the system. This prints the kernel release date, version, processor type, etc. 

 

Others Some Extra

  1. You can use the clear command to clear the terminal if it gets filled up with too many commands.
  2. TAB can be used to fill up in terminal. For example, You just need to type “cd Doc” and then TAB and the terminal fills the rest up and makes it “cd Documents”.
  3. Ctrl + C can be used to stop any command in terminal safely. If it doesn't stop with that, then Ctrl+Z can be used to force stop it.
  4. You can exit from the terminal by using the exit command.
  5. You can power off or reboot the computer by using the command sudo halt and sudo reboot.
# Reference Article #

In this Article we learned the basic Linux Commands and how does it work.


Thanks To Reading...

Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.