DEV Community

Cover image for Mastering Linux Terminal: Essential Commands for Beginners
Oluwafemi Ajao
Oluwafemi Ajao

Posted on

Mastering Linux Terminal: Essential Commands for Beginners

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

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

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

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

Logging in as Root User:

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

"sudo su"

Image description

Listing Items:

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

"ls"

Image description

Printing Working Directory:

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

"pwd"

Image description

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

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

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

Exit Command:

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

"exit"

Image description

Shutdown Command:

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

"sudo shutdown now"

Image description

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

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

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!

Top comments (0)