Mastering Linux Terminal: Essential Commands for Beginners
Published: 2024-03-02 10:34:51




The Linux terminal is a powerful tool that allows users to interact with the operating system through text-based commands. Whether you're a seasoned Linux user or just getting started, understanding the fundamental commands is essential for efficient system management. In this article, we'll explore some essential commands for creating users, managing directories, navigating the file system, and performing basic system tasks.

##Creating a User:

To create a new user in Linux, you can use the useradd command followed by the desired username. For example:


"sudo useradd username"


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/82yh5felwuw86669cpa3.png)

##Creating a New Password:

Once a user is created, you can set a password for the user using the passwd command. Simply type passwd followed by the username:



"sudo passwd username"


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0nebscuc2b469dulyepw.png)



##Deleting a Directory:

To delete a directory in Linux, you can use the rmdir command followed by the directory name:




"rmdir directory_name"



![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ndr8r5afuv2y87yclq15.png)


##Deleting Text Files:

To delete a text file in Linux, you can use the rm command followed by the file name:


"rm filename.txt"


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bplvj2w1ner0z1ohbhhs.png)


##Logging in as Root User:

To log in as the root user in Linux, you can use the su command:


"sudo su"


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7z2fj10l2c39rxcnt42r.png)




##Listing Items:

To list the contents of a directory in Linux, you can use the ls command:


"ls"


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jy73b5bsuy7822hc3hbg.png)




##Printing Working Directory:

To print the current working directory in Linux, you can use the pwd command:



"pwd"


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lqdg150hsbcs6zgqccgs.png)




##Going to Home Folder:

To navigate to the home folder of the current user in Linux, you can use the cd command followed by the tilde ~ symbol:


"cd" 


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fil37ka81e9ufbo399py.png)




##Returning to a Previous Level:

To navigate back to the previous directory in Linux, you can use the cd command followed by two dots ..:


"cd .."


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8pq5eyhsgdbkwugt7nkc.png)




##Moving a Level Up:

To move up one level in the directory hierarchy in Linux, you can use the cd command followed by a forward slash /:


"cd /"


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kwoqz915hia93oy2udn0.png)




##Exit Command:

To exit the terminal session in Linux, you can use the exit command:


"exit"


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fih5z5weoby4mdd6i2i3.png)




##Shutdown Command:

To shut down the Linux system, you can use the shutdown command followed by the appropriate options:


"sudo shutdown now"


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dj7a01ropd63ac5ymibc.png)




##Cat Command:

To display the contents of a text file in Linux, you can use the cat command followed by the file name:


"cat filename.txt"


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u54gca2up9gyna93g4fa.png)




##Ping Command:


To check the network connectivity to a host in Linux, you can use the ping command followed by the host name or IP address:


"ping host_" or "ping ip-address"


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q0ey5vk6nd172l2o6445.png)




These are just a few of the essential commands you'll encounter when working in the Linux terminal. By mastering these commands, you'll be well-equipped to navigate the Linux file system, manage users and permissions, and perform basic system tasks with ease. Experiment with these commands in your Linux environment to gain familiarity and confidence in using the terminal. Happy coding!