In this article, we are going to learn some basic Linux commands. Which is most important to understand. And if you want to learn Linux you have to know about these Linux commands. All commands are used in any Linux distribution. The Linux command line is a text interface to your computer. Often referred to as the shell, terminal, console, prompt, or various other names, it can give the appearance of being complex and confusing to use.
Basic Linux Commands
So first of all you have to open your favorite terminal in Linux. It depends on the distribution that you are using, you can simply find the terminal in the utility section. I am using Ubuntu so you have to click on Activities and just search Terminal.
Here is a list of basic Linux commands:
whoami Command
The whoami command print the user name who is currently logged in. The whoami command prints the name of the user associated with the current effective user ID. The syntax for whoami command:
$ whoami
pwd Command
The pwd command is also known as the print working directory. This command shows the current working directory where you are in. This command shows you the full path of your current directory. The syntax for pwd command:
$ pwd
cd Command
The cd command is also known as change directory. Using this command you can change the directory and go to any directory using this command. It requires the full path of the directory, depends on your current working directory. This command is to enter you in any directory and also exit from it. The syntax for the cd command:
$ cd [path]
ls Command
The ls command is used to view the content of the directory. By default, this command displays the current directory content. But if you want to see the content from other directories then you have to enter the path of the directory with the ls command.
There are variations you can use with the ls command:
- ls -R will list all the files in the sub-directories as well
- ls -a will show the hidden files
- ls -al will list the files and directories with detailed information like the permissions, size, owner, etc.
$ ls [OPTION]... [FILE]
cat Command
The cat command is one of the most important commands in the Linux operating system. The cat command is using to create a single file or multiple files, view the content of the file, concatenate files and redirect output in terminal or files.
The cat command is used for:
- Display text file on screen
- Read text file
- Create a new text file
- File concatenation
- Modifying file
- Combining text files
cp Command
The cp command is used to copy the file from one directory to another directory. The syntax for cp command:
$ cp [source] [destination]
mv Command
The mv command is used to move the file from one directory to another directory. But it is also used for renaming, yes if you want to rename the file or directory then you have to use the mv command for it. The syntax for the mv command:
$ mv [source] [destination]
To rename the files in Linux. The syntax for (rename the files) mv command:
$ mv [old name] [new name]
mkdir Command
The mkdir (Make Directory)command is to be used for making a new directory. If you want to create multiple directories in single command then you have to use the p (parents) option with the mkdir command.
$ mkdir [OPTION]... DIRECTORY
rmdir Command
If you need to delete a directory, use the rmdir command. However, rmdir only allows you to delete empty directories.
$ rmdir [OPTION]... DIRECTORY
rm Command
The rm (remove) command is used to remove or delete the directories with their contents.
$ rm [OPTION]... [FILE]
sudo command
The sudo command is known as Super User, this command gives you administrative or root permissions.
$ sudo [execute the command]
Conclusion
Basic Linux commands help you to execute the task easily and fast. You have done some practice on these commands so you can easily execute all these commands. So all these commands are necessary for Linux beginners who want to learn Linux. There is a lot of commands which is necessary, but you can easily use Linux if you know these command which is mentioned in the article. GOOD LUCK!