Every User Should Know These 15 Basic Linux Commands

by | Jan 24, 2023 | Uncategorized

The Linux operating system appears to be too difficult to operate; command lines may make you think of a programming procedure that requires skill or knowledge to understand.

I should clarify, don’t be alarmed. We wish to start with 15 fundamental Linux commands so that new users can quickly become accustomed to this well-liked open-source user interface.

You might wish to obtain a sense of the significance of commands in most distros before reading the list of the 15 commands every Linux user should know. Because of this, the first part provides some fundamental definitions and explanations.

A 16th command, or rather the 0th command since it’s arguably much more crucial than the others, should also be included, in my opinion: apt. In many Linux distributions, such as Debian and Ubuntu, it is essentially used to instal and delete packages. If your OS has a GUI, you may just click on a few screens to replace the majority of these 15 commands. However, you cannot change the fact that apt is required for the majority of packages to be installed through the terminal. Is there no GUI desktop on your Linux system? Not a problem; simply look at my tutorial on installing a GUI on Ubuntu Server to understand just how crucial apt is

The Simplest Linux Commands You Should Understand

Most people think of Linux as a difficult operating system that programmers use. However, it is not as challenging as they had imagined. You will discover that Linux commands serve as an intuitive interface for assisting users in administering, troubleshooting, or even optimising the OS and its applications as you become more familiar with this open-source operating system and its variants.

As you may already be aware, your device’s command-line interface (CLI) is a text-based user interface (UI) that can do almost all necessary activities (A typically black box with white text that is also known as a command-line processor or command-line interpreter)

The bash (Bourne Again Shell) shell, which supports all the commands of the original Bourne Shell as well as many additional, is one of the most widely used styles of command-line interface for Linux. It was created as a free and open-source alternative to the Bourne shell that incorporates capabilities from the Korn shell (KSH) and C shell, including command-line editing, command history, and command substitution syntax (CSH). Additionally, it can handle brace expansion, which is used to create text strings.

Due to bash’s open nature, it is used as the default user shell by the majority of Linux distributions, all versions of Apple’s macOS, the Windows Subsystem for Linux, and the Solaris Operating System. Simply open a terminal from the desktop’s application menu to access the bash shell in Linux. From there, you can begin writing shell scripts. (Keep in mind that you can alter your default shell depending on how your system administrator has configured things.) A prompt to enter the code will appear as soon as a terminal opens.

It’s time to start learning some Linux coding, now. Following is a collection of fundamental Linux commands with examples that every Linux user should be familiar with:

Note-Typically, a command would have the following syntax:

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

Note 2- As a result of the case-sensitivity of commands, files, and directory names in a Linux shell, PWD will print the current working directory but will return the following error:

Bash: PWD: command not found

Note 3- The file type will be determined automatically in Linux CLI because file extensions are irrelevant.

Note 4- The


(Forward-slash) is a unique character that is used to separate directories.

Note 5- Almost all Linux commands back up the claim that they will assist you on your journey using the Command-line interface.

- - help

Note 6- The sign, which precedes each syntax in this article, is a prompt that lets us know the shell is ready for input.


1- ls command

The ls command, short for List, is the answer if you want to list files or directories within the file system of the Linux operating system. You have a number of alternatives when using this command, including the table below:

ls ~It displays the home directory’s contents.
ls ../It displays the parent directory’s contents.
ls –versionIt verifies the ls command’s version.
ls -alist all files, hidden and visible, beginning with “.”
ls –colorColored list [=always/never/auto]
ls -dlist directories – with ‘ */’
ls -FShows file types (“/” = directory, “*” = executable)
ls -liThis command prints the index number if the file is the first column.
ls -la lengthy format list (permissions, size, ownership, and modification date)
ls -laFlisting hidden files in a lengthy format
ls -lhlisting lengthily formatted lists with sizes shown in human-readable file units (KB, MB, GB)
ls -lsa big list that includes the file size (descending)
ls -rlist in reverse order
ls -Rlist recursively directory tree
ls -slist file size
ls -Ssort by file size
ls -tsort by modification time & date – it will open the last file you edited
ls -Xsort by extension name

2- pwd command

As we mentioned,

$ pwd [option]

is one of the cheat sheets for fundamental Linux commands. The current working directory can be readily printed out starting at the root. The two flags for this command are:

Pwd –L

displays the symbolic link name along with the current working directory’s logical path.

Pwd –P

displays the physical path of the active working directory without the symbolic link’s name.

3- alias

This command enables you to specify a shortcut or abbreviation to reference a command (or group of commands) in order to avoid repeatedly typing a lengthy command. In reality, the alias command will be helpful when you need to utilise a command repeatedly. By developing a special command that can switch out one string for another while running tasks, it can save you time. You can utilise this shortcut numerous times. In this situation, we construct 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

Linux and other Unix-like operating systems will update your current directory when you run this command. In other words, the cd command, which stands for “change directory,” is one of the most common and fundamental Linux commands used on the Linux terminal. For this command, the syntax is

cd [options] directory

Here are a few instances of how to use this command:
Providing your home directory contains the Downloads directory. You may easily get there by using the following code:

cd Downloads

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

cd /home/username/Downloads

As you can see, the (/) symbol displays the directory’s absolute path. In addition, you can move down or up a level in the current directory. For example, let’s say 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 chosen directory’s name contains a space, you should use the backslash () character, as illustrated below:

cd Dir\beta\router\hosting

5-mv command

Using this command, you can transfer one or more files or folders across locations. The syntax of this basic Linux command is listed below with some examples.


The DESTINATION must be a single directory or file, while the SOURCE might be one or more directories or files. You must have write rights on both SOURCE and DESTINATION in order to move a directory or file. You will see a permission denied error otherwise.

Just renaming a file requires the syntax shown below.

mv [filename] [new_filename]

For example:

mv names.txt fullnames.txt

Similar to that, use the following syntax to relocate a file to a new location

mv [filename] [dest-dir]

For example:

mv fullnames.txt /home/routerhosting1/Downloads

Using the -i command-line option, you can compel the mv command to prompt:

mv -i [filename] [new_filename]

By using this syntax, mv will request the user’s permission before overwriting a file.

6- cat command

One of the most popular and fundamental Linux commands, cat (short for concatenate), enables users to create single or many files, concatenate files, see the contents of files, and redirect outputs into files or terminals. This command’s common syntax looks 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:

7- cp command

COPY is the meaning of the command cp. This command can copy a single file or directory or a collection of them. In its argument, it needs at least two filenames. This command’s syntax could look something like this:

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

The source file is copied to the destination or directory using the first and second syntaxes. For copying numerous files (sources) to the directory, use the third syntax.

Figure 1:

cp file file-backup

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

Example 2:

cp file1.txt dir file2.txt dir

This programme will copy several files and directories simultaneously. In this instance, a directory must be the final destination.

8- mkdir command

Users of Linux can create new directories with this command. You can create many directories at once and specify permissions with the mkdir command. This command’s syntax for creating a single directory looks like this:

mkdir [option] dir-name


mkdir test-dir

Using this command, a test directory will be created. Use the following syntax to create many folders at once:

mkdir {test1, test2, test3}

9- rmdir command

Another command in our list of fundamental Linux commands is rmdir, which you may use to delete empty directories from the Linux disc. The following command’s syntax is demonstrated.

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


In the

rmdir –p

each of directories


rmdir mydir1 mydir2 mydir3

In this example, mydir1mydir2, 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: This option treats each directory argument as a pathname that will be deleted. In that case, the final component will begin.
  • With the rmdir -v, -verbose option, each directory that is being processed can have verbose information displayed.
  • With the rmdir -ignore – fail – on – non – empty option, an error message won’t be reported if a directory isn’t empty.
  • Using the rmdir -version option, you can quit while also viewing the version details.

10- rm command

The rm command is the answer when you want to delete folders and everything within of them. Use rm -r, however, if you merely want to remove the directory. The syntax resembles the short-code shown below:

rm [option] FILE


rm test.txt

This command will permanently remove the test.txt directory.

11- Touch command

Another fundamental Linux command that enables the creation of new blank files is called touch.

touch file name is the syntax.


Touch /Home /username/Documents/Me.txt as an illustration.

With this command, a single text file is created at the specified location (documents). if you want to make several files in a specific location.

Touch File1 name, File2 name, and File3 name in syntax


contact -a: A specific file’s access time can be changed with this command. It is advised to change or update a file’s last access times.

12- Locate command

In Windows, the locate command serves as a search command. The simplest approach to search for files is by name, even if you don’t know the precise name.

Locate [filename] in syntax]



Find -i Book*note

This command searches for files containing the terms “book” and “note,” regardless of case.

13- df command

The Df command, which stands for “Disk Free,” provides you with a report on the system’s detail, including the quantity of disc space, space used, and consumption.

You can receive the readable disc space summary in byte, megabyte, or gigabyte format.

Example: MegaBytes

df -m


  • df
  • df /dir
  • df [option] [/dev/DEVICE]

14- Kill command

You can manually end applications, however the kill command makes it easier to collapse unresponsive programmes.


kill [signal option]
kill PID


Users typically utilise one of two signals when using the kill command:

SIGKILL: This signal compels all running programmes to end as soon as feasible, without saving any programme changes in the process.

SIGTERM: This signal terminates a programme, but unlike SIGKILL, it permits the programme to save all of the modifications.

15- useradd, userdel command

Linux, a multi-user operating system, allows for simultaneous access from numerous users. Therefore, in order to interact with the system, numerous users must be created.

Passwd is used to set the password for the user account created by the Useradd command, which also creates a new user.

Grammar: useradd [OPTIONS] USERNAME


useradd JohnSmith

Userdl: Deleting a user account removes both the user and their associated files. With a small modification, this command functions similarly to creating a user.

UserName: userdel Syntax


userdel JohnSmith


userdel -f: This option will compel the removal of the user.

userdel -r: This command removes a user together with their mail spool, home directory, and associated files.


  • userdel -f Jack
  • userdel -r John

How Do I Use Simple Linux Commands?

No matter if you want to practise fundamental Linux commands or test/analyze your shell scripts online, you should first thoroughly comprehend them. You can use Windows Subsystem for Linux to instal Linux inside of Windows to practise them. Additionally, you can use online Linux terminals. Some websites offer online Linux terminals that you may use to execute standard Linux commands in a web browser to test or practise them.


Linux comes with a great variety of commands, but we’ve selected the ones you’ll use the most. In this article, we described several fundamental Linux commands through code examples. However, depending on the distribution you’re using, the methods may vary; for assistance, you can use Linux or simply leave a remark.


How Do PWD and /bin/PWD Differ From One Another?

While /bin/pwd is an utility that comes with your Linux distribution, pwd is a built-in command in the shell. Use /bin/pwd to indicate that you wish to run the standalone application rather than the built-in command of the shell.

What Commands Can I Run 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.

How Does CLI Work?

A text-based interface called a command line interface (CLI) is used to enter and execute commands. It was the norm for computer interaction prior to the invention of the mouse. Each CLI contains a command prompt where users can enter commands.

What Purpose Does Command-Line Serve?

The fact that the command line accepts several commands makes it the finest tool. This interface enables you to type commands that your computer’s operating system can then execute. You can also browse your device’s files and folders using the command line.

What Is a Cheat Sheet for Linux?

You might need to know any of the hundreds of commands available in Linux. You can find and remember them more quickly by using a Linux cheat sheet. You can find commands linked to the following information on such a sheet:

  • Hardware details on the system
  • Monitoring performance and statistics
  • Information and administration of users
  • directory and file commands
  • Process control
  • File access rights

Read Our Next Articles Overviews of VPS with Nested virtualization