We use Linux commands to navigate various folders and functionalities since Linux is a command-based operating system (OS) unlike Windows.
Therefore, Linux has enough commands to do all what you may need to do in any other operating system like Windows. However, mastering these commands is not easy especially for beginners.
But on close look, you will find that Linux commands are based on just a few commands that are expanded to do various functionalities. We call these basic Linux commands.
We recommend to anyone starting to learn Linux to master these basic commands first. Then it will be easier to learn the rest of the commands. So if you are new to Linux, master only these 9 basic commands to prepare you in becoming Linux guru.
The 9 Basic Linux commands for Beginners
Below is a summary of the 9 basic Linux commands. In our explanation, we will state what the commands means in plain English then brief explain what the command does. Note that each of these commands can be written with other letters to do various functions. However, this section will only cover the basic command.
- pwd (Print Working Directory)
Pwd is used to identify which directory you are currently in. When you launch terminal, you are in the home directory called the root. Linux home or base is called root. So by typing root, it should show you /root directory.
2. cd (Change Directory)
Command we use to navigate to a directory. Syntax: write cd <directory> then hit enter button. For example, cd Downloads takes to the Downloads directory. Take note that cd command is case sensitive. If you type downloads to mean Downloads in the above example results to an error:
3. ls (List)
Linux command that lists files inside a directory. ls stands for list. Once in a directory, typing ls and enter will show which files are inside that directory.
4. mkdir (Make Directory)
Command used to create a new directory or new folder. For example, to create directory Exams, just type mdkdir Exams then hit enter button. A folder named Exams will be created in the directory you are currently in.
5. rmdir (Remove Directory)
This command deletes or removes directory or files. Simply type rmdir before the directory name then hit enter. If you type ls, you will see the directory will be empty.
6. rm (Remove)
Linux command to delete files or directory. The difference between rm and rmdir is that rmdir is for specifically deleting directories while rm can remove both directories and files. rm –r deletes directories only. rm deletes both the folder and files.
7. cp (Copy)
Command to copy a file or a directory and paste it in another directory. cp command must take two arguments: source and destination directory. The syntax is cp origin_directory destination_directory.
8. mv (Move)
Command that move files from one directory to another. Just like copy, mv command takes two arguments. The syntax is “mv source_dir destination_dir” then click Enter key. Also, the command can be used to rename a folder. How “mv him her” command will rename a folder named him to her.
9. locate (Locate files)
This command is equivalent of search command or button in windows. Used to search a file you are not sure where it is located in a Linux system. The common problem for files you don’t know where they are is that you don’t know how they are saved, uppercase or lowercase
The 7 Basic Linux Shortcut You Must Know
While you type above commands to in the terminal, shortcuts assist you to easily navigate various parts of the OS. Below are 7 basic shortcuts that will help you significantly.
- TAB key
Used to autocomplete directory names. For example, to navigate to the Downloads folder. You type cd Down then hit the enter button, the terminal will complete the command to cd Downloads.
Used to terminate a Linux command currently running in the terminal
Used to force a command to terminate if Ctrl+C command is unable to stop it.
Command you can use to clear all output in the terminal Just type “clear” in the Linux terminal and hit Enter. All contents in the terminal will clear and you will left with empty screen.
Display all commands you have executed in the terminal in chronological order. This very important if you want to confirm any command if you had used clear before.
Command to show manual pages under certain command.
7. Command – – help
This command helps you understand the meaning of Linux commands, what they do, and various options available for that particular commands. Syntax of using this command is just type a command, hit space bar to space, then two dashes followed by the word help and hit Enter key.