10 Linux Commands Every User Should Know


Reading Time: 8 minutes


Are you looking to learn more about Linux? Or maybe, you are a new Linux user/developer who needs to learn some basic Linux commands? This guide is like a Linux commands cheat sheet. In this tutorial, you will learn 10 basic Linux commands that every user should know.

The Most Important Linux Commands You Should Know

Most people imagine Linux as a complicated operating system that is used by programmers. But it is not as difficult as in their thoughts. As you get more familiar with this open-source operating system and its distributions, you will find out Linux commands as an easy-to-use interface for helping users in managing, troubleshooting, or even optimizing the OS and its applications.
As you may know, this command-line interface (CLI) is a text-based user interface (UI) in your device where can run nearly all required tasks (A typically black box with white text that is also known as a command-line processor or command-line interpreter).

One of the most popular types of command-line interface for Linux is bash (Bourne Again Shell) shell that supports all the commands of the original Bourne Shell, as well as many others. It was written as a free and open-source replacement for Bourne shell that includes features such as command-line editing, command history, and command substitution syntax from the Korn shell (ksh), and C shell (csh). It can also support brace expansion that is used for generating text strings.

Linux VPS Hosting

Get yourself an economy or premium Linux VPS for hosting your website or remote desktop, at the cheapest price out there. VPS Running on Linux KVM for increased efficiency and working on powerful hardware with NVMe SSD storage for increased speed.

Check Out Linux VPS Plans
Linux VPS Hosting

Having the open nature of bash, most Linux distributions, all releases of Apple’s macOS, Windows Subsystem for Linux, and Solaris Operating system use that as a default user shell. To open the bash shell in Linux, just launch a terminal from your desktop’s application menu and start shell scripting. (Remember that, depending on how your system administrator has set things up, you can change your default shell). When a terminal opens, it will present a prompt to write the code.

✅Now, it’s time to learn some Linux codes. In the following, a list of some Linux basic commands with examples will be presented that every Linux user should know:

Note 1: the typical syntax of a command can be something like this:

command [-argument] [ - - long-argument] file

Note 2: commands, files, and directory names in a Linux shell are case sensitive, meaning that PWD will print the current working directory but PWD will return the following error:

Bash: PWD: command not found

Note 3: file extension doesn’t matter which means in Linux CLI, the file type will automatically determine.

Note 4: the


(forward-slash) is a special character used for directory separating.

Note 5: nearly all Linux commands support the

- - help

argument to help you during the journey with the Command-line interface.

Note 6: the


sign is a prompt that shows us that the shell is waiting for input and comes before every syntax in this article.

1- ls command

If you wish to list files or directories within the file system of Linux OS, then the ls command (short for List) is the solution. Using this command, you have a variety of options such as the following table:

5 Best Mail Servers for Linux OS
Option Description
ls ~ It gives the contents of the home directory
ls ../ It gives the contents of the parent directory
ls –version It checks the version of ls command
ls -a list all files including hidden file starting with ‘.’
ls –color Colored list [=always/never/auto]
ls -d list directories – with ‘ */’
ls -F Shows file types (“/” = directory, “*” = executable)
ls -li If file is the first column, then this command prints the index number
ls -l list with long format (permissions, size, ownership, and modification date)
ls -laF list long format including hidden files
ls -lh list long format list with size displayed using human-readable file units (KB, MB, GB)
ls -ls list with long format with file size (descending)
ls -r list in reverse order
ls -R list recursively directory tree
ls -s list file size
ls -S sort by file size
ls -t sort by modification time & date – it will open the last file you edited
ls -X sort by extension name

2-pwd command

As we mentioned,

$ pwd [option]

is one of the basic Linux commands cheat sheet. It can easily print out the current working directory starting from the root. This command has two flags:

Pwd –L

Displays the current working directory logical path with the symbolic link name.

Pwd –P

Displays the current working directory physical path without the symbolic link name.


This command lets you instruct a shortcut, or an abbreviation to reference a command (or set of commands) to avoid typing a long command several times. In fact, when you need to use a command over and over, the alias command will be useful. It can save your time by creating a unique command that can replace one string with another while executing the commands. This shortcut can be used multiple times. In this case, we create something called an alias for that command.

The syntax of this command is:

alias [-p] [name [=value] …]

Or, it can be something like this:

alias alias_name="command_to_run"

4-cd command

This command will change your current directory in Linux and other Unix-like operating systems. In other words, the cd (short for Change Directory) command is one of the most frequently used and one of the basic Linux commands that is used on the Linux terminal. The syntax for this command is:

cd [options] directory

Here is a few examples of using this command:

Assuming that the Downloads directory exists in your home directory. Using the following code, you can simply navigate to it:

$ cd Downloads

You can also navigate to it by using the absolute path:

$ cd /home/username/Downloads

As you can see (/) sign shows the absolute path to the directory. You can also navigate one or more levels up from the current directory. To do so, suppose you are currently in the


directory, to switch to the


directory (one level up), you would type:

$ cd . ./

This command moves you one level up from the current directory. To move two levels up to the


directory, you could run the following code:

$ cd . ./ . ./

You can also navigate to the previous working directory using a dash character as an argument to the cd command like the following:

$ cd -

Or navigate to the home directory by using a tilde (~), as shown below:

$ cd ~

For example, if you want to navigate from


directory to the


directory, you would type:

$ cd ~/Downloads

Note: if the selected directory has a space in its name, you should use backslash (\) character to escape the space, as shown below:

$ cd Dir\beta\router\hosting

5-mv command

This command is used to move one or more files or directories from one place to another. Following is the syntax of this Linux basic command with a few examples:


The SOURCE can be one or more directories or files, and the DESTINATION must be a single directory or file. To move a directory or file, you need to write permissions on both SOURCE and DESTINATION. Otherwise, you will receive a permission denied error.

If you want to just rename a file, type the following syntax:

mv [filename] [new_filename]

For example:

mv names.txt fullnames.txt

Similarly, if you want to move a file to a new location, use the following syntax:

mv [filename] [dest-dir]

For example:

mv fullnames.txt /home/routerhosting1/Downloads

You can force the mv command to prompt by using the –i command line option:

mv -i [filename] [new_filename]

This syntax leads to mv asking for user permission before overwriting an existing file.

Minecraft VPS Hosting [Best Minecraft Server Hosting in 2021]

6-cat command

The cat (short for concatenate) command is one of the most frequently used and one of the basic Linux commands that allows users to create single or multiple files, concatenate files, view contents of files, and redirect outputs in files or terminal. The typical syntax of this command is something like this:

cat [option] [file] . . .


Cat /123456/test/file01/123456/test/file02

The following table shows the main options for using the cat command:

option description
cat test Displays the contents of a file
cat test1 test2 Displays the contents of test1 and test2
cat test1; teat2; test3 Displays multiple files at once
cat -b adds line numbers to non-blank lines
cat -n filename Shows contents and adds line numbers to all lines
cat -s Squeezes blank lines to one line
cat -e Shows $ at the end of the line. Good for squeezing multiple lines in a single line
cat –T test shows ^I instead of tabs
cat test1 teat2 test3 > test4 Redirecting multiple file’s contents in a single file
cat > test1 Will create a file named test1
cat test1 >> test2 Will append the contents of one file to the end of another file

7-cp command

The cp command stands for COPY. This command can copy a single or a group of files or directories. It requires at least two filenames in its argument. Syntax of this command can be something like the following:

cp [option] Source Destination
cp [option] Source Directory
cp [option] Source-1 Source-2 Source-3 Source-n Directory

The first and second syntax is used for copying the source file to the destination or directory. The third syntax is used for copying multiple files (sources) to the directory.


cp file file-backup

This code will copy a file named file.txt to file-backup.txt.


cp file1.txt dir file2.txt dir

This code will copy multiple files and directories at once. In this case, the destination must be a directory.

8-mkdir command

This Linux command allows users to make new directories. With mkdir command, you can also set permissions, and create multiple folders at once. The syntax of this command for making a single directory is something like this:

mkdir [option] dir-name


mkdir test-dir

This command will create a new directory named test. If you wish to create multiple directories at once, use the following syntax:

mkdir {test1, test2, test3}

9-rmdir command

Another command of our provided Linux basic commands list is rmdir that allows you to remove empty directories from the filesystem in Linux. The syntax of this command is shown in the following:

rmdir [-p] [-v ǀ -verbose] [-ignore – fail – on – non – empty] directories …


5 Best Mail Servers for Linux OS

In the

rmdir –p

each of directories


rmdir mydir1 mydir2 mydir3

In this example, mydir1, mydir2, and mydir3 will be removed, if they are empty. If any of these directories are not empty, then an error message will be printed for that directory and other directories will not be removed.


  • rmdir –p: Each of the directory arguments treated as a pathname that will be removed, in this option. If they are empty, the last component will start.
  • rmdir –v, -verbose: this option can display verbose information for each directory that is being processed.
  • rmdir -ignore – fail – on – non – empty: if a directory isn’t empty, this option will not report an error message for occurred failure.
  • rmdir –version: this option used for displaying the version information and exit.

10- rm command

When you are going to remove directories and the contents within them, the rm command is the solution. But, if you only want to delete the directory, use rm –r. The syntax is something like the following short-code:

rm [option] FILE


rm test.txt

This command will permanently remove the test.txt directory.

How to Practice Basic Linux Commands?

No matter you want to test /analyze your shell scripts online or want to practice basic Linux commands, you should first understand them well. To practice them, you can install Linux inside Windows using Windows Subsystem for Linux. You can also use online Linux terminals. Some websites provide you with online Linux terminals to run regular Linux commands in a web browser so that you can test them or practice them.

In conclusion

Linux includes a large number of commands but we’ve chosen the most frequently needed commands for you. In this article, we explained some of the basic Linux commands with examples of coding. However, the steps may differ based on the distributions that you’re using; you can use the help of the Linux, or even comment us to help you.


1. What Is the Difference Between pwd and /bin/pwd?

The pwd is a built-in command in the shell while /bin/pwd is a tool that comes with your Linux distribution. To specify that you want to run the stand-alone program instead of the shell built-in command, use /bin/pwd.

2. How Do I Run Commands in Linux?

First, launch a terminal from your desktop’s application menu. Then try to find the bash shell that is the default shell in most Linux distributions. Now, type a command and press enter to run it.

3. What Does CLI mean?

A Command Line Interface (CLI) is a text-based interface used for typing and running commands. Before mouse, it was the standard way to interact with a computer. Every CLI has a command prompt for accepting a command.

4. What Is the Use of Command-Line?

The best use of the command line is that it takes a lot of commands. This interface helps you to enter a command that can pass on to the operating system of your computer and run. Using the command line, you can also navigate through files and folders of your device.

5. What Is a Linux Cheat Sheet?

There are hundreds of Linux commands that you may need to know. A Linux Cheat Sheet can help you to easily find and remember them. Such a sheet can show you commands related to the following information:

  • System information
  • Hardware information
  • Performance monitoring and statistics
  • User information and management
  • File and directory commands
  • Process management
  • File permissions
Master student in computer software engineering Intrested in programming, web developing, and cloud computing


Leave A Comment