If you’re a long-time Windows user, new to Linux, using the terminal may feel like alien territory.
After all, you’re probably more accustomed to being able to point here, click there to get things done.
And, while some Linux distributions like Mint have a user friendly graphical interface, the core of Linux is the kernel, which means you’ll want to access the command line occasionally to fully customize your user experience.
Here are some of the most useful basic Linux commands you’ll want to know to comfortably navigate the command line.
You can use the cd command to change the directory you are to another directory. Let’s say you are currently in folder1 which is located to /home/user/Desktop/folder1 and want to go to folder2 which is located in the same location. To do that simply type cd and the location of folder you want to browse, in this case you are already on folder1, so to go folder 2 you need to type cd /home/user/Desktop/folder2.
Another way could be via
cd .. command, this command will take you back to desktop, so to access folder2 you need to type only
The touch command allows you to create empty files. For Example: The command "touch ebblr.txt" will create an empty txt file called ebblr.
ls will list all the files and directories of the current directory you are in.
W command will print the information about users who are currently logged in.
Whoami prints the username of the owner of the current session.
Use mkdir to create a directory. Type mkdir and the name you want to use for the directory that you are creating.
Example : mkdir myfolder, will create a folder called myfolder.
rmdir is the opposite of mkdir, mkdir will create a folder, rmdir will delete it. So, to delete a folder you need to type rmdir and the location of folder that you want to delete.
rmdir /home/user/Desktop/folder1, will delete the folder called folder1.
Remember, rmdir will not delete a folder if it’s not empty. Use the following instead
sudo rm -rf /home/user/Desktop/folder1
Use cp command to copy a file from a directory to another. For example : We are going to copy song1.mp3 which is located on /home/user/music/song1.mp3 to a subdirectory on music folder, called newmusic. To do that, you need to type the following
sudo cp /home/user/music/song1.mp3 /home/user/music/newmusic
mv command allows you to move a file to a directory. Let’s say we want to move file.txt to a directory located on desktop. To do this, type mv file.txt /home/user/Desktop/.
mv file.txt /home/user/Desktop/
Pwd will print the working directory you are currently. Pwd is very useful command, specially when you are browsing through a lot of directories and want to know the full path.
That means, you are currently on /home/username
History it’s another very useful command. The main function of this command is to print all the commands that you’ve used on terminal.
Clear will clear your terminal screen.
Uptime is a command that will show you how long your system has been up.
Date prints the current time and date of your system.
Short for ‘manual’, provides useful and detailed information for any other Linux command you specify. Think of it as a help page.
man intro is a good place to start if you’re new to Linux with an introduction to User Commands and the Linux command line.
When typing a command, just press TAB for auto-complete.