Basic Linux Commands Every Beginner Should Master First

May 19, 2023 (4mo ago)

linux terminal

Learning a new operating system can be intimidating, especially if you aren’t familiar with the commands you need to know. Linux is no different, but it doesn’t have to be overwhelming.

It’s important for all Linux beginners to first understand the basic commands that are essential to mastering the system. Knowing how to use these commands can save you a lot of time and effort when it comes to setting up your system and managing files.

In this blog post, I'll be walking through some of the basic Linux commands that every beginner should master before they dive deeper into the operating system. We'll explain what they do, how to use them, and give some examples for each one so that you can get started on the right foot.

Navigating the Linux file system is a crucial skill for any beginner to master. Two of the most used commands are pwd and cd.


pwd stands for print working directory and it displays your current directory on the command line. This is useful when you want to double check that you’re in the right directory before running a command.


cd stands for change directory and it allows you to move around in the file system, or view a list of its contents. Try using cd <directory name> to change directories, or cd ../ to move up one level. You can also use ls, which stands for list, to view all files and folders within a given directory.

By mastering these three commands, you’ll be well on your way forming a good understanding of Linux navigation.

Managing Files and Folders: Mkdir, Rm, Cp, Mv

Learning the basics of Linux commands is an essential step for any beginner. The four main commands for managing files and folders are mkDIR, RM, CP, and MV.


MKDIR creates a new folder. It stands for Make Directory and allows you to assign a name to the folder. For example, if you wanted to create a folder called ‘myfolder’, you would type mkDIR myfolder.


RM stands for Remove. It deletes a file or folder from your system. When you delete something using this command, it cannot be undone, so use caution when entering this command. For instance, if you wanted to delete the ‘myfolder’ we just created, you could type RM -r myfolder.


CP or Copy can be used to duplicate files or folders. This is useful if you want to make a backup or simply need to store an extra copy of something safely. For example, if you wanted another copy of ‘myfolder’ on your computer, just type CP -r myfolder myotherfolder.


Finally, MV or Move is used to rename files or folders as well as move them from one directory to another. So, if we had a file called ‘myfile’ in our ‘myfolder’ directory that we wanted moved out of it and renamed ‘mynewfile’ at the same time, we would type MV myfile ./../mynewfile.

Reading and Editing Text Files: Cat, Nano, Vim

When working with text files on a Linux system it is important to know how to read, edit and create them. To do this, three key commands you should learn are cat, nano and vim.

What is cat?

The cat command allows you to display the contents of a text file in the terminal. It stands for "concatenate," which means combine or link multiple items together. Simply use the command followed by the file path and name, for example: cat example.txt.

Editing Text Files with nano

The nano text editor is an easy-to-use tool for quickly reading, editing, and creating text documents on the command line. To use it, type nano followed by the file name you wish to open or create. Then use its intuitive menu bar to read, edit and save your document.

Advanced Editing with Vim

Vim (Vi Improved) is a powerful, modal text editor designed for experienced users who need advanced features such as syntax highlighting and folding. Similarly to nano, type vim into the terminal followed by your desired file name or path to open or create said file. For detailed information about Vim's features see their online documentation vimdoc.

Working With Permissions: Chmod, Chown, CHGRP

If you're working with Linux, you'll need to learn how to work with permissions. Fortunately, there are three main commands that will help you manage them: chmod, chown and chgrp.

These commands allow you to change the permissions of files and directories, change ownership of a file/directory and assign a group to a file/directory respectively. Here's an overview of each:


This command is used to modify the permission levels associated with a file or directory. The permissions can be expressed in octal notation (with numbers 0-7) or symbolic notation (as letters r, w, x). For example, the command chmod 755 filename would grant read and execute access for all users and write access for the owner only.


The chown command allows you to change the ownership of a file or directory. This can be useful if you want to give certain users or groups more access than others. The syntax for this command is chown user_name:group_name filename, where user_name and group_name are replaced accordingly.


Finally, the chgrp command allows you to assign a group name to a file or directory. To do this properly, use the syntax chgrp group_name filename. If the command is successful, it will return "Group changed" followed by the filename on its own line underneath it.

Installing and Updating Software: Apt, Apt-Get, DNF

Whether you are using a Debian-based Linux distribution such as Ubuntu or a Red Hat/Fedora-based Linux distribution, the commands for installing and updating software packages will be similar. The apt, apt-get, and dnf commands are your go-to tools for these tasks.

Apt: Debian-Based Distributions

The apt (Advance Packaging Tool) command is used to manage packages on Debian distributions such as Ubuntu. It is used to install applications, update packages, and delete software packages.

To get started with apt, make sure to run sudo apt update to refresh the list of available applications and their versions. To install an application, run sudo apt install <application name>.

Apt-Get: Fedora/Red Hat

Apt-get is used on Fedora and Red Hat distributions of Linux. It's very similar to the apt command, but it has slightly different syntax when performing tasks. For example, sudo yum install <package name> is the syntax used to install a package using yum instead of apt.

Similarly to apt on Debian distributions, make sure you always run sudo yum update before attempting to install any new packages - this will keep your software up to date with the latest security patches and bug fixes.

DNF: Fedora 22+

The dnf (Dandified YUM) command is used in Fedora 22 and later versions instead of yum. It offers improved performance over yum in terms of searching for available packages; however the syntax remains largely unchanged from yum: sudo dnf install <package name> will install a package just like yum did in earlier versions of Fedora; sudo dnf check-update updates a list of available packages as opposed to simply running sudo dnf upgrade.

Running Programs: Compiling From Source and Using Binary Executables

Compiling from source and using binary executables are two of the most common ways to run programs on Linux systems. Let's take a look at what each entails.

Compiling From Source

Sometimes, Linux users need to compile programs directly from their source code. This is especially helpful when the desired software is not available in any of the user's package repositories or as a pre-compiled binary.

Compiling from source involves the following steps:

  1. Unpacking and configuring the software as per instructions in the accompanying README file (this includes installing all required packages)

  2. Compiling the source code with make and make install commands

  3. Testing if compilation was successful using make check

  4. Installing required libraries using apt-get install

  5. Running software with the command-line program you've created

By building from source, users can benefit from having complete control over their software, making it easier to customize their system for specific purposes.

Using Binary Executables

If you don't want to compile your software from its source code, you can instead use binary executables—files that are already compiled into a format ready for installation and execution on Linux systems. Binary files are often available online in tarball archives or as Debian packages (.deb files). Binary files can be installed with the command sudo dpkg -i .deb or sudo apt install .tar.gz, depending on the distribution and type of executable used.

Once installed, these programs can be run directly from a terminal or opened through an application launcher like GNOME Shell's Dashboard or KDE Plasma Workspaces' Kickoff menu .


With the knowledge and understanding of these basic Linux commands, you can easily make your way around the Linux operating system with ease. These commands are all-important for gaining a better understanding of the system and the ability to control your environment like a pro. With a bit of practice and exploration, you can quickly take your first steps into the world of Linux and discover the powerful potential of the operating system.