Top Linux commands every beginner should know

Many people use Linux without even knowing the basic commands. This article will provide a list of top Linux commands every beginner should know.
This introduces some of the essential Linux commands for beginners. We’ve provided examples with explanations and in-depth descriptions that may prove useful as you explore more advanced topics in your quest to master this powerful operating system. So what are you waiting for let’s get started.
What are Linux commands?
Most Linux distributions feature graphical user interfaces (GUIs) like windows, making it easier to navigate between files. However, there is another way to do all that stuff using the command line interface(CLI) which offers more control and takes less time. Linux commands are executed on a Terminal similar to the command prompt (cmd) of windows. The terminal is a command line interface this can interact with the system via small texts.
This is the general syntax of Linux commands.
[Command] [-option] [parameter]Code language: Bash (bash)
- The Command is the name of the operation which you want to perform. Ex:
ls, cd - The option is to know more about the command performed. You must include the hyphen before writing the option you want to perform. Ex:
ls -a(Shows all hidden files) - parameters are the necessary information required for the command to perform. Ex:
cd code(changes to code directory here code is the parameter) - Remember all Linux commands are case-sensitive. Most of the Linux commands are small letters by the way
Top Linux Commands
pwd
The pwd command prints the route of the directory you’re present in. pwd – Present Working Directory. It is a basic command everyone should know and very easy to use.
root@ubuntu:~$ pwd
/rootCode language: Bash (bash)cd
Moving through directories is very much necessary while navigating your files. The cd command allows changing to some other inside directories. Suppose you want to change to Documents directory to a subdirectory of the root. To do that enter the following command.
root@ubuntu:~$ cd Documents
root@ubuntu:~/Documents$Code language: Bash (bash)
You can see your path has been changed to Documents. You can confirm it by using the pwd command.
root@ubuntu:~/Documents$ pwd
root/DocumentsCode language: Bash (bash)
Some tips to navigate
cd ~directly comes to the user’s root directorycd ..comes to the previous directory- Hit the Tab button after entering the
cd. It will autocomplete the directory present in it.
ls
The ls command lists all the things present in your path directory. It will show Text files, directories, and everything that’s there in there in your path directory. For example, if you want to see what’s there in your Document folder first navigate to your Documents folder
Then enter the following code
root@ubuntu:~/Documents$lsCode language: Bash (bash)
It is one of the most frequent commands used. It has a lot of options to
ls -alists all the hidden files plus visible onesls -lhshows the space occupied by that file & lost modified datels -Rlists all the files present in your subfolders.
tree
The tree command is used to view the files in a directory in a tree-like fashion
root@ubuntu:~$treeCode language: Bash (bash)

If you get an error saying that the tree command is not recognised. Just enter the command
sudo apt install treeCode language: Bash (bash)
this will get rid-off the error. we will learn more about the sudo command in the upcoming section
sudo
Sudo means superuser do. It is the most powerful and most frequently used command in Linux administration. After entering the command the terminal asks for a password just enter your user’s password not the root user password account. sudo allows you to access restricted files and operations. sudo command has a lot of options. We will discuss some here
root@ubuntu:~$sudo --version
root@ubuntu:~$sudo -l
root@ubuntu:~$sudo shutdown
root@ubuntu:~$sudo updateCode language: Bash (bash)
sudo --versioncommand prints the version numbersudo -llists all the commands you can use.sudo shutdownkills the systemsudo updatecommand updates your Linux distribution to the latest version.
mkdir,rmdir
You can create directories using the mkdir command. And can remove them using the rmdir command. mkdir means make directory rmdir means remove directory. For example, if you want to create a directory called code
root@ubuntu:~$mkdir codeCode language: Bash (bash)
mkdir commands have a few options they are
mkdir code-vprints the message “created directory ‘code1’” in terminalmkdir code/webYou can create a subdirectory called code directly using themkdircommand
And to remove that directory you can use the command rmdir code
root@ubuntu:~$rmdir codeCode language: Bash (bash)
touch
We can create files using the touch command. For example to create an hello.txt file, first, navigate through the folders to where you want to create the hello.txt then enter the command
root@ubuntu:~/web$touch hello.txtCode language: Bash (bash)
Here I created an hello.txt file in the web directory. You can verify that using the ls command
rm
rm stands for remove as you already guessed this command is used to remove files permanently. For example, if we want to remove the hello.txt file we created in the last section.
root@ubuntu:~$rm hello.txtCode language: Bash (bash)
mv, cp
mv stands for move and cp stands for the `copy. You can use these commands to move and copy your files from one directory to another. Using the mv command you can rename the files. For example, if I want to change code.txt to codedamn.txt
root@ubuntu:~$mv code.txt codedamn.txtCode language: Bash (bash)
cp command is also used in the same way as the mv command. For example, if I want to copy the text in code.txt to codedamn.txt enter the following command
root@ubuntu:~$cp code.txt codedamn.txtCode language: Bash (bash)
cat
The cat command allows viewing the content inside the files directly from the terminal. cat (concatenate), using the cat command you can view multiple files also
root@ubuntu:~$cat index.htmlCode language: Bash (bash)

history
The command history will show all the commands the user has executed in the past. You can even find information about the commands you executed.
root@ubuntu:~$historyCode language: Bash (bash)
clear
The command clear clears the terminal it erases everything that’s there on the terminal.
root@ubuntu:~$clearCode language: Bash (bash)
exit
exit command exits the current terminal when you hit the enter button
root@ubuntu:~$exitCode language: Bash (bash)
whoami
The whoami command display’s current logged in user name.
root@ubuntu:~$whoami
rootCode language: Bash (bash)
If your using a single computer you won’t use this command frequently. But when your using multiple systems you are gonna use this a lot.
Conclusion
These are the Linux commands every beginner should learn. To learn even more about these commands just enter the command that you want to learn followed by –help. Example: ls --help you can about it in the terminal itself. You can check out the course on codedamn for a detailed explanation at codedamn.
Now don’t mug up all the commands just consistently keep on using them wherever needed You will automatically remember them. Now You can navigate through your files more quickly and easily. The commands are basic yet essential to anyone who is using Linux. That’s it from this article hope you learned something new. Thank You!
Sharing is caring
Did you like what Thrishank wrote? Thank them for their work by sharing it on social media.
No comments so far
Curious about this topic? Continue your journey with these coding courses: