Most Used Linux Commands You Should Know! Part-1
A lot of people find Linux more challenging as an operating system especially when they are coming from the comfort of using Windows or macOS. Here, I'm presenting you the basic but very important Linux commands to give you an in-depth knowledge of how to use your Linux terminal.
Command 1:
whoami
This command displays the id of the user logged in. It is a way to check if you are logged in with the right account before performing any operation.
Command 2:
who
This command displays all the users logged into the linux server
Command 3:
mkdir dir1
This command creates a new directory "dir1" in the server.
Command 4:
mkdir -p d1/d2/d3/d4
This command creates sub-directories, just use the parent (-p)
Command 5:
rmdir dir_name
This command removes an empty directory from the server.
Command 6:
rm -r dir_name
This command removes a directory which has files and sub directories from the server.
Command 7:
cd dir_name
This command is used to navigate from one directory to another directory.
Note:
"." represents current directory
".." represents parent directory
"~" represents home directory of current user
Example: cd ~ will take control to home directory of current user
Command 8:
touch file1
This command creates empty files in the server
Command 9:
touch file1 file2 file3
This command creates multiple empty files in the server. Note: It can also be used for updating the time stamp of the files.
Command 10:
cat > file_name
This command creates files that can store some data in the file. To come out of cat command (ctrl+d). This represents EOF(End Of File). Note: a) cat creates a new file if the file is already not present. b) It will overwrite the content of the existing file if file is already present.
Command 11:
cat file_name
This command displays the content of a file.
Command 12:
cat >> file_name
This command appends data to an exisiting file. Enter some data and press "ctrl+d" to exit.
Command 13:
rm file_name
This command removes a file from the server.
Command 14:
echo $HOME
This command displays the home directory of current user.
Summary
The key is to use these commands more often in your daily activities. Once you master these commands, it becomes your best ally, and you won’t regret choosing it as your daily driver.
One of the remarkable things about Linux is that even if you’re an experienced user, you’ll never stop learning to be more productive using it.
There are a lot more helpful Linux commands. If we’ve left something out, please share your favorite Linux commands in the comments below!
Happy Learning!
Community and Social Footprints :
Subscribe to my newsletter
Read articles from Sampath Kumar Basa directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Sampath Kumar Basa
Sampath Kumar Basa
Infra as Code (IaC) | AWS Hero | Teacher | Mentor | Youtuber | -> Way to Cloud & MLOPS