Do you think that the command lines are an old-fashion leftover from previous decades or an antiquated way of using a PC? Think again. Indeed, it is one of the most powerful and flexible ways to perform and manage in Linux. If you come from the comfort of a Mac or Window desktop, however, it can be a bit intimidating to get used to Linux commands. Everything is secretive, dark, and anything but friendly to beginners. That’s why we have rounded up this short list of the most useful Linux commands with examples. Keep reading and speed up your learning journey with Linux.
1. Ls command – list files
is one of the most basic and common commands in Linux. You can use it
to print contents in the current working directory and see the list of
files, directories, or folders on your Linux system.
For instance, the command “ls tourism” will display the users every folder store inside the overall “tourism” folder. Keep in mind that directories and files will be denoted in different colors, which can be selected in the system.
You would also use the command “ls – R” to display all files both in the directories and subdirectories. Since Linux commands are case sensitive, make sure to enter “R” instead of “r” to avoid an error.
2. Cat command – create and view files
use the “cat” command to show text files. Also, it would be used for
creating, combining, and copying text files. For example, use “cat
linux_tip” to get inside the linux_tip file and read its contents on
To combine two text files “linux_tip_1” and “linux_tip_2, you can enter the following command “cat linux_tip_1 linux_tip_2 > linux_tip”. Keep in mind that only text documents would be combined and shown with this command.
3. Rm command – delete files
“Rm” command can be used for removing files or directories from your
Linux system without confirmation. The syntax is simple “Rm
For example, the command “rm computer_science” will immediately remove the file or directory named “computer_science” from your computer. Make sure to consider carefully before using this command because you cannot get it back.
To move and rename files, the “mv” command will be used. Here is the basic syntax for this task: “mv filename new_location.”
Suppose that you need to move the file name “english_class” to location “/home/school/documents”, just enter the command “mv english_class /home/school/documents.” Keep in mind that this command requires the permission of users.
The syntax for renaming a file is “mv filename newname”. An example command is “mv english_class french_class”
5. Mkdir – create directories
you want to create a new directory in your Linux system, then you can
use the “mkdir” command. The syntax is “mkdir new_directory.”
For instance, you can create a new directory named “final homework” by typing the following command “mkdir final_homework.” In case you do not want to make a parent directory manually, add the -p argument. Keep in mind that it is -p, not -P. Everything in Linux is case sensitive.
6. Rmdir command – remove directories
contrast with the mkdir command, you can use the rmdir command to
remove a directory. The syntax is similar: “rmdir removed_directory.”
If you enter the following command “rmdir basketball_data”, it will immediately delete the directory named “basketball_data”. Always check carefully to make sure that there is no sub-directory or file under the deleted directory. If possible, it is always better to delete the sub-directory or files first before moving to the parent one.
7. Man command – seek help in Linux
simply stands for manual. You can use this command to access a
reference book of the Linux system, which is quite similar to the
“Help” file in many popular applications or software. To seek help on
any commands that you don’t understand, just enter “ma command_name”.
The terminal will open a manual page for the typed command.
For example, if you enter “man ls”, the terminal will provide you with basic information on the “ls” command.
8. History command – view previous commands
As you can guess from the name, the “history” command can be used to display all of the commands that you just used previously for the current session. This can be helpful in referring to the old commands and re-entering or re-using them in the next operations.