In this post, I want to share 10 Linux commands that gets you started on your Linux journey. These commands are basic but interesting enough to arouse your interest in Linux.
I will be using the Ubuntu OS installed on Virtual box for this demonstration. The commands will be entered one after the other with details of their function.
10 Linux commands for beginners.
1. PWD: Print Working Directory. The pwd command is used to print the current directory user is working in. Directories are same as folders and since it could be difficult to know the folder that a user is working on from the terminal window, the pwd commands comes in handy. The image below shows how it is used.
2. LS : List Directory: The LS command is used to list items contained in the present working directory of the user. When used in the desktop directory, it lists items on the desktop. See ouput from the use of this command below.
3. CD / : Back to root directory. This command, when used, takes the user back to the root directory. The root directory is the core directory where every other directory resides. It is attached the user’s username. This command makes returning to the root directory faster as the user does not need to exit a step at a time. See output from the use of the cd / command below.
4. CD : Change directory. Another command among the 10 linux commands we are looking into is the change directory command. As the name depicts, the cd command is used to change directory. It must be followed by the name of the directory the user wants to change to. Please, note that Linux is case sensitive and requires that the directory name be typed the way it is on the computer. For example. Desktop is not the same as desktop. The output below shows the result of using the cd command to change from the root directory to Desktop.
Because there is no direct movement from the root directory to Desktop, I had to from the root to /home/timigate/Desktop.
5. CD .. : Back to previous directory. The cd .. command takes you back to the directory before the present one. It can be used to exit a folder on the desktop and back to the the desktop. See output from its use below. It takes you out one directory at a time.
6. CP : Copy files. The CP command is used to copy files from one directory to the other. It is used followed by the name of the file to be copied, then, the new location that file is to be stored.
Okay, here is what I did up there. First, I used the cp command to copy a file named test.odt to a directory named Official. Then, I used the cd command to move into the directory named Official. To see the contents of the directory named official, I used the LS command. The command showed that the file named test.odt has been copied into the directory.
7. RM : Remove files. The rm command is used to remove a file. This is same as delete in Windows. It is used, followed by the file name to of the file to be removed. See output below.
The file named test.odt was removed from the directory named Official, using the rm command. After that, I used the LS command to see the contents of the directory and it showed there was nothing in it anymore.
8. MRDIR : Make New Directory. The mkdir command is used to create a directory or a folder as it is known in Windows OS. Simply go to the directory in which you want to create a folder, type in mkdir followed by the name of the directory. See example below.
I made a directory named TimiFolder, moved into it with the “cd TimiFolder” command, moved back to the host folder with the cd .. command and viewed the content of the host folder (Official) using the LS command. As can be seen, the directory named Official contained another directory named TimiFolder.
9. RMDIR : Remove Directory. This command, like the name, is used to remove an empty directory. Simply go to the directory hosting the one to be removed and enter the command followed by the name of the directory to the removed. See example below.
I removed the directory named TimiFolder, then used the LS command to verify that it has been removed. The LS command showed no items, confirming that TimiFolder has been removed.
10. RM -R : Remove non-empty directory. Last on the list of 10 linux commands for beginners, is the RM -R command. The command is used to remove a directory containing other directories or files.