10 Basic Linux Commands For Beginners


The operating system Linux is free and open-source. Based on the Linux kernel, this operating system is an example of a typical Linux distribution package. It was created for computers running the Intel x86 architecture. In the Linux environment, there are a plethora of commands with countless additional uses. These are some of the 10 Basic Linux Commands For Beginners for Linux that users often use when working with the operating system.

What Is a Linux Command?

A command-line program or utility is referred to as a Linux command. A command line is an interface that takes text lines and converts them into instructions for your computer.

A graphical user interface (GUI) is merely a command-line program abstraction. For instance, there is a command that operates when you click the “X” to close a window.

1. ls Command:

Most likely, the first command that any Linux user entered into their terminal was ls. You can use it to list all of the files and other nested directories within the directory you specify (which is the current directory by default).


2. pwd command:

The built-in shell command pwd, which stands for print working directory, prints the current location. An absolute directory path, beginning with the root directory (/), is displayed in the output.

The general syntax is:

pwd <options>

To see how the command works, run the following in the terminal:


3. mkdir command

This mkdir command allows you to create fresh directories in the terminal itself. The default syntax is mkdir <directory name> and the new directory will be created.

For example, if you want to create a directory as “GeeksforGeeks” then the basic syntax would be:

mkdir GeeksforGeeks

4. mkdir command

Use the mkdir command to create one or multiple directories and set their permissions. Ensure you are authorized to make a new folder in the parent directory. Here’s the basic syntax:

mkdir [option] [directory_name]

To create a folder within a directory, use the path as the command parameter. For example, mkdir music/songs will create a songs folder inside music. Here are several common mkdir command options:

  • -p – creates a directory between two existing folders. For example, mkdir -p Music/2023/Songs creates a new 2023 directory.
  • -m – sets the folder permissions. For instance, enter mkdir -m777 directory to create a directory with read, write, and execute permissions for all users.
  • -v – prints a message for each created directory.

5. alias Command

The alias command lets you define temporary aliases in your shell session. When creating an alias, you instruct your shell to replace a word with a series of commands.

For example, to set ls to have color without typing the --color flag every time, you would use:

alias ls="ls --color=auto"

As you can see, the alias command takes one key-value pair parameter: alias NAME="VALUE". Note that the value must be inside quotes.

If you want to list all the aliases you have in your shell session, you can run the alias command without argument.


6. echo:

This command prints out the text to the command-line interface. The ‘echo’ command is used to print the text and can be used in the scripts and bash files as well. It can be put into the output status text to the main screen or any required file. It is also helpful in depicting environmental variables in the system. For example, write out the following command in the terminal:

echo “Hello World”

7. rmdir command:

Use the rmdir command to delete an empty directory in Linux. The user must have sudo privileges in the parent directory. Here’s the syntax:

rmdir [option] directory_name

If the folder contains a subdirectory, the command will return an error. To force delete a non-empty directory, use the -p option.

8. passwd:

Though it looks similar to the pwd command, this command is very different. This command is used to change the user account password.You could change your password or the password of other users. Note that the normal system users may only change their own password, while root may modify the password for any account.

passwd [username]– changes the password for the user.

$ passwd admin


9. cp command:

Use the cp command to copy files or directories, including their content, from your current location to another. It has various use cases, such as:

Copying one file from the current directory to another folder. Specify the file name and target path:

cp filename.txt /home/username/Documents

Duplicating multiple files to a directory. Enter the file names and the destination path:

  • cp filename1.txt filename2.txt filename3.txt /home/username/Documents

Copying a file’s content to another within the same directory. Enter the source and the destination file:

  • cp filename1.txt filename2.txt

Duplicating an entire directory. Pass the -R flag followed by the source and destination directory:

  • cp -R /home/username/Documents /home/username/Documents_backup

10. head command:

The head command prints the first ten lines of a text file or piped data in your command-line interface. Here’s the general syntax:

head [option] [file]

For instance, to view the first ten lines of note.txt in the current directory, enter:

head note.txt

The head command accepts several options, such as:

  • -n – changes the number of lines printed. For example, head -n 5 shows the first five lines.
  • -c – prints the file’s first customized number of bytes.
  • -q – disables headers specifying the file name.
The head command with the -n 5 option outputs the first five lines of a file in Terminal


We hope that this list of basic Linux commands will assist you in getting started. There are more such commands in Linux and these are only a few of them; you’ll discover many more as time goes on, but this is a good place to start. The best way to learn Linux is to experiment with these commands. So, as a beginner, this article is best for you to go through each and implement those wherever required.

Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, Linuxhints are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!
Get more information about
How to Encrypt a Drive in Ubutu 22.04

Leave a Reply

Your email address will not be published. Required fields are marked *