DevOps 101 - A Comprehensive Guide to Linux for DevOps - Command Set 1

A Comprehensive Guide to Linux for DevOps

This is a multi-part series on DevOps 101. Access the complete DevOps series by clicking HERE

Access Set 2 of the Linux Commands for DevOps by clicking HERE

Linux is one of the most popular operating systems used in DevOps. In DevOps, the focus is on streamlining the software development pipeline through automation and collaboration between software development and IT operations teams.

Linux is preferred by DevOps professionals because of its open-source nature, flexibility, and customizability. Linux provides a stable platform for DevOps automation tools such as Ansible, Chef, and Puppet. These automation tools help in managing configuration, deployment, and scaling of applications.

Furthermore, Linux offers a vast array of command-line tools that enable rapid development and deployment of software applications by automating manual tasks.

Introduction to Linux

Linux is a free and open-source operating system that has gained significant popularity in recent years. It was first released in 1991 by Linus Torvalds and has since been developed by a large community of developers worldwide.

Linux is known for its reliability, security, and powerful command-line interface. It is used by millions of people worldwide, from individual users to large corporations and governments.

One of the main advantages of Linux is that it comes in many different distributions, or “distros,” each with their own unique features and characteristics. Some of the most popular distros include Ubuntu, Debian, Fedora, and Red Hat Enterprise Linux.

One of the unique aspects of Linux is that it is highly customizable and modular. Unlike other operating systems, where you are limited in what you can do with the software, Linux allows you to modify and customize the software to suit your needs.

Another advantage of Linux is that it is free. This makes it an attractive option for individuals and organizations that want to save money on software licensing fees.

Linux is also known for its security features. Because it is open-source, anyone can examine the code and identify vulnerabilities, which can then be patched and fixed. Additionally, Linux is less of a target for viruses and malware because it has a smaller user base compared to other operating systems like Windows and macOS.

Linux is also known for its versatility. It can be used for a wide range of applications, from running servers to powering embedded systems to running on desktop computers. This makes it highly adaptable and allows it to be used in many different contexts and settings.

Linux Distributions (Distros)

Linux Distros

Linux is an operating system built on the open-source software model. One of the main advantages of Linux is its flexibility regarding customization and modification. Linux distros are different flavors or versions of the operating system. Each of them comes with different features, capabilities, and interface. Below are some of the widely known Linux distros.

  1. Ubuntu – Ubuntu is one of the most popular and user-friendly Linux distros available today. It is based on Debian and comes pre-installed with various essential applications and tools. Ubuntu provides a robust foundation for developers and a modern interface for general users.
  2. Fedora – Fedora is another robust and widely used Linux distribution. It focuses on the latest features and is known as a cutting-edge distro. Similar to Ubuntu, Fedora comes pre-installed with various useful tools and applications to make the user experience smoother.
  3. Arch Linux – Arch Linux is known for its flexibility, customization, and minimum setup. It is a lightweight and minimalist distribution that puts the user in full control. Arch Linux uses a rolling release model that means it is continuously updated so there is no need for a fresh installation.
  4. Debian – Debian is one of the oldest Linux distributions and is known for its stability and reliability. It is widely used for servers and comes with various productivity tools. Debian has a huge community of users and developers who constantly update and maintain its packages.
  5. Linux Mint – Linux Mint is a user-friendly alternative to Ubuntu. It is also based on Debian and comes with numerous tools and applications out of the box. Linux Mint aims to provide a familiar interface to Windows users to make the transition to Linux smoother.
  6. CentOS (Discontinued) – CentOS is similar to Debian in terms of stability and reliability. It is a popular choice for servers and comes with various tools for efficient management and administration. CentOS is also a community-driven project, so it is regularly updated and maintained.
  7. OpenSUSE – OpenSUSE is a distro that focuses on stability, performance, and ease of use. It uses the YaST tool for management and administration purposes and comes with a huge variety of tools and applications that cater to different needs.

These are some of the well-known Linux distributions. Each has its own unique features and strengths. The choice of distribution should be based on your needs and objectives.

Installation of Ubuntu


In this entire series, we will be using Ubuntu because it is simple and easy to use for anyone who has not used any Linux OS before.

Before we continue, there are 4 ways to install Ubuntu:

  • Clean installation of Ubuntu
  • Installing alongside Windows
  • Installing on a Virtual Machine
  • Installing on WSL

In this entire series, we will use Ubuntu on WSL as this is the path most people will go for their first taste of Linux. But, I will also be touching (in brief) the other 3 methods listed above.

Web capture 29 5 2023 3440

Clean installation of Ubuntu

If you’re looking to install Ubuntu on your system, you may find it a bit daunting, but it is relatively easy to do so:

  1. Download Ubuntu ISO File:

    • First things first, download the latest version of Ubuntu from the official website.
    • Make sure to select the right architecture, 32-bit or 64-bit, depending on your system.
  2. Burn the Ubuntu ISO File to a USB or DVD:

    • Once you’ve downloaded Ubuntu, you’ll need it on a USB or a DVD.
    • Insert a blank USB flash drive (at least 4 GB of space) or DVD into your computer and launch your preferred DVD burner software.
    • Burn the ISO image to the USB or DVD.
  3. Boot from the Ubuntu USB/DVD:

    • Restart your computer and boot it up from the Ubuntu USB drive or DVD.
    • If the USB or DVD is not set as the first boot device in your BIOS, then you will have to access the BIOS setup and modify the boot order.
  4. Start the Ubuntu Installation Process:

    • Once you’ve booted into Ubuntu, you’ll see a screen with two options: Try Ubuntu and Install Ubuntu.
    • Choose the Install Ubuntu option to begin the installation process.
  5. Select the Language and Location:

    • Select your preferred language and location.
  6. Choose the Installation Type:

    • Choose the installation type that suits you the best. You can either erase your entire disk and install Ubuntu or choose to manually partition the disk.
  7. Create a User Account:

    • Once you’ve selected the installation type, Ubuntu will ask you to create a user account with a username and password.
    • You can also choose to log in automatically.
  8. Installation of Ubuntu:

    • After you’ve set up your user account, Ubuntu will begin the installation process.
    • Sit back and relax as the installation can take several minutes.
  9. Restart Your Computer and boot into the shiny new installation of Ubuntu!

Installing alongside Windows

The following step-by-step guide will help you to install Ubuntu alongside Windows:

  1. The first step in installing Ubuntu alongside Windows is to create a bootable USB or DVD. You can download the latest version of Ubuntu from the official website. Once downloaded, you can use tools like Rufus or BalenaEtcher to create a bootable USB or DVD.
  2. Once you have created a bootable USB or DVD, insert it into your computer and restart your computer.
  3. During the boot process, you will need to access the boot menu of your computer. The key to access the boot menu varies depending on the manufacturer of your computer. Typically, the key is F12 or F11.
  4. Once you have accessed the boot menu, select the bootable USB or DVD that you have created in step 1.
  5. The Ubuntu installation wizard will load up and prompt you to select your language. Once you have selected your language, click on the “Install Ubuntu” option.
  6. The next step is to select the location that you want to install Ubuntu on. You will be prompted to either erase everything on your computer and install Ubuntu or to install Ubuntu alongside your current operating system. Select the “Install Ubuntu alongside Windows” option.
  7. You will then be asked to allocate disk space for Ubuntu. You can adjust the partition size by dragging the slider to the left or right. Make sure that you leave enough space for both operating systems to function properly.
  8. Once you have set up your disk space allocation, you will be asked to create a username and password for your Ubuntu installation. This will also be used to log in to your Ubuntu system.
  9. The next step is to click on the “Install” button to begin the actual installation process. This may take some time, so it’s important that you do not interrupt the process.
  10. Once the installation process is complete, you will be prompted to restart your computer. Make sure that you remove your bootable USB or DVD before restarting your computer.
  11. When your computer restarts, you will be greeted with a boot menu that allows you to select which operating system you want to use. Select Ubuntu to boot into your new Ubuntu installation.

Installing on a Virtual Machine

Here is a step-by-step guide for installing Ubuntu on Virtual Box:

  1. Download Virtual Box from the official website and install it on your computer.
  2. Next, download the Ubuntu image file (ISO) from the Ubuntu website.
  3. Open Virtual Box and click “New” to create a new virtual machine.
  4. Name your virtual machine, select “Linux” as the type, and choose “Ubuntu” as the version.
  5. Set the amount of RAM that you want to allocate to your virtual machine. At least 2 GB is recommended for a comfortable experience.
  6. Create a virtual hard disk for your virtual machine by clicking the “Create” button.
  7. Choose “VDI” as the hard disk type and “Dynamically Allocated” as the storage type.
  8. Choose the amount of storage that you want to allocate to your virtual machine. We recommend at least 20 GB.
  9. Click “Create” to create the virtual hard disk.
  10. Select your newly created virtual machine and click “Settings”.
  11. Click “Storage” and then click “Empty” under the “Controller: IDE” section.
  12. Click the “Choose Virtual Optical Disk File” button and select the Ubuntu ISO file that you downloaded earlier.
  13. Click “OK” to save the settings.
  14. Start your virtual machine by clicking “Start”.
  15. Ubuntu will boot up from the ISO image file that you selected earlier.
  16. Follow the on-screen instructions to install Ubuntu on your virtual machine.
  17. Once Ubuntu is installed, restart your virtual machine and enjoy your new Ubuntu installation running on Virtual Box.

Installing on WSL

Screenshot 2023 05 29 030622

Installing Ubuntu on WSL (Windows Subsystem for Linux) is an easy and straightforward process. Here are the step by step instructions in bullets:

  1. First, you need to enable the WSL feature on your Windows machine. Go to “Control Panel” > “Programs” > “Turn Windows features on or off” > Check “Windows Subsystem for Linux” > Click “OK”.
  2. After enabling WSL, you need to open the Microsoft Store and search for “Ubuntu”. Install the latest version of the Ubuntu app available.
  3. Once the Ubuntu app is installed, open it from the Start menu or the Microsoft Store. The first time you launch it, it will take a few minutes to download and set up the Ubuntu environment.
  4. After the installation is complete, you can launch Ubuntu from the Start menu or by typing “Ubuntu” in the Windows search bar.
  5. The first time you launch the Ubuntu app, you need to set up a username and password for your Ubuntu environment.

  6. You can then start installing the packages and tools you need using Ubuntu’s package manager, apt-get. For example, you can install the build-essential package by running the command “sudo apt-get install build-essential”.
  7. You can also access your Windows files and folders from within Ubuntu by navigating to “/mnt/c/” in the Ubuntu file system. This allows you to seamlessly work with files and folders on both Windows and Ubuntu.
Screenshot 2023 05 29 073409

Linux Shell

Linux shell, also known as command-line interface (CLI) or terminal, is a powerful tool for interacting with a computer’s operating system. It provides users with the ability to perform numerous tasks with simple commands, making it a convenient and efficient alternative to graphical user interfaces (GUIs).

One of the strengths of the Linux shell is its flexibility and customization options. Users can customize their shell with various configuration files and scripts to suit their personal preferences and needs. This allows for a highly personalized working environment that can improve productivity and workflow.

Another significant advantage of the Linux shell is its power in automation and scripting. With the use of various tools and scripts, users can automate repetitive tasks, such as file management, system backups, and software installations. This can save considerable time and effort for system administrators and developers.

The Linux shell also offers a wide range of utilities and tools for system management and troubleshooting. From monitoring system performance to debugging issues, the shell provides users with the ability to diagnose and fix problems quickly and efficiently.

Moreover, the shell offers numerous built-in commands and utilities for file and directory management, text processing, network communication, and system administration, making it a comprehensive tool for users with varying needs and skill levels.

Commonly Used Linux Shell Commands

The following video covers the first half of the commands listed below in depth:

Here are some of the commonly used Linux shell commands that are covered in the above video:

  • man
  • ls
  • cd
  • pwd
  • mkdir
  • rmdir
  • mv
  • cp
  • open
  • touch
  • find
  • ln
  • gzip
  • gunzip
  • tar
  • alias
  • cat
  • less
  • tail
  • wc
  • grep
  • sort
  • uniq
  • diff
  • echo
  • chown
  • chmod
  • unmask
  • du
  • df
  • basename
  • dirname
  • ps
  • top
  • kill
  • killall
  • jobs
  • bg
  • fg
  • type
  • which
  • vim
  • emacs
  • nano
  • whoami
  • who
  • su
  • sudo
  • passwd
  • ping
  • traceroute
  • clear
  • history
  • export
  • crontab
  • uname
  • env
  • printenv

Now, let us take a look at each one of them, one by one.

This post covers upto the umask command. Stay tuned for the next part, which will cover the next set of commands.

The man command

The “man” command in Linux is a vital tool for accessing detailed documentation about different programs and utilities on a system. It stands for “manual” and provides a convenient way of accessing various help pages on the command line. With “man,” you can display information like command syntax, usage examples, and more, making it an invaluable resource for Linux users and developers alike. The man command is simple to use, with the format being “man [command].”

The ls command

The Linux ls command is used to list directories and files in a specified location. It displays the names of all the files and folders in the directory and provides several options for customization, including sorting by modification time, file size, and extension. The command also allows the user to view hidden files, display detailed file information, and show the contents of subdirectories recursively. It is a simple yet essential tool for navigating the Linux file system efficiently.

The cd command

The cd command in Linux is used to change the current working directory. It is an essential command for navigating through the file system. To use the cd command, simply type “cd” followed by the directory path you wish to change to. You can also use relative or absolute paths as arguments for the cd command. The cd command is a fundamental tool for any Linux user, both for file management and for running scripts or applications.

The pwd command

The pwd command in Linux stands for “print working directory”. When this command is executed, it returns the absolute pathname of the current working directory. This can be useful when navigating the file system in a terminal session, as it allows the user to verify where they are located in the file hierarchy. The pwd command can be used in conjunction with other shell commands to create scripts that automate file system tasks.

The mkdir command

The mkdir command in Linux is used for creating new directories in the file system. It stands for “make directory” and allows users to make one or more directories at the same time. To create a new directory using mkdir, simply type “mkdir” followed by the name of the directory you want to create. By default, the new folder is created in the current working directory. Additional options can be used to specify permissions for the new directory or to create directories within directories.

The rmdir command

The rmdir command in Linux is used to delete empty directories. The basic syntax of the command is ‘rmdir [directoryName]’. This command only works on directories that are empty and will not remove directories that contain files or subdirectories. The command can be used with an additional flag (-p) to remove nested directories all at once. To delete non-empty directories, use ‘rm -rf [directoryName]’.

The mv command

The “mv” command in Linux is used to move or rename files and directories. It takes two arguments: the source file or directory to be moved or renamed, and the destination directory or new file name. If the destination directory already exists, the source file or directory is moved into it. If the destination directory does not exist, the “mv” command will rename the source file or directory with the new name specified in the destination argument. The old file or directory name will no longer exist. This command is commonly used when reorganizing files or when renaming files.

The cp command

The cp command is one of the most frequently used commands in Linux for copying files and directories. This command allows users to copy files and directories from one location to another within the same file system or across file systems. It provides several options for manipulating the copying process, including preserving file attributes and permissions, copying recursively, and prompting before overwriting existing files. Users can also specify the destination directory or file name to modify the location or name of the copied file or directory.

The open command

In Linux, the open command is used to open a file or directory using the default program or application. This command can also be used to open a file in a non-default application by specifying the application name. Additionally, the open command can also be used to launch a URL in the default web browser. In case of Ubuntu, we have to use xdg-open instead of open. xdg-open can be installed by typing ‘apt install xdg-utils’.

The touch command

The touch command in Linux is a simple and yet powerful command used to create empty files or to update the access and modification time of an existing file. It changes the timestamp of the file, but does not change its contents. Touch command is often used in shell scripting to create a file as a placeholder or to update a file’s timestamp after modifying it. It is easy to use with a standard syntax and has various options to change the file timestamp, create multiple files, or specify the file format. The touch command is a handy tool for managing file timestamps efficiently on Linux systems.

The find command

The “find” command in Linux is a powerful tool for searching for files and directories within the Linux file system. It allows the user to search for a specific file by name, type, size, or date modified. The command can also be used to execute tasks on the files found, such as copying, moving, or deleting. The syntax for the command is “find [path] [expression]” where the path specifies the location to search and the expression sets the criteria for the search.

The ln command

The ln command in Linux is used to create hard and symbolic links between files. A hard link is a direct connection between two files, while a symbolic link is like a shortcut that points to the original file. When creating a hard link, any changes made to either file will affect the other. With symbolic links, changes made to the original file will also be reflected in the linked file, but changes made to the linked file will not affect the original.

The gzip command

The gzip command in Linux is used to compress files in order to save space and facilitate easier transfer of files. This compression utility uses Lempel-Ziv coding (LZ77) to compress files and is often used in conjunction with tar to create compressed archives. Gzip creates a compressed file with the .gz extension, and has various options such as -r for compressing recursively and -c for writing to standard output. Overall, the gzip command is a useful tool for managing disk space and file transfer in Linux.

The gunzip command

The gunzip command is a popular tool used in Linux for decompressing files that were compressed using gzip. Gzip is a software application that uses a lossless data compression algorithm to compress files, and gunzip is the tool used to reverse that process and decompress the files. The resulting file is identical to the original file, but it takes up less disk space. The gunzip command supports a variety of options, such as preserving file attributes and timestamps, and can be used in conjunction with other Linux commands to manipulate compressed files.

The tar command

The tar command is a commonly used utility in Linux systems that is used to create archives and backup files. The name “tar” comes from “tape archive,” which harkens back to the days when tapes were used to store data. With tar, you can package multiple files and directories into a single archive file, which can be compressed for additional space savings. The tar command offers many options for customization, such as compression, encryption, and appending to existing archives.

The alias command

The alias command in Linux allows you to create your own custom commands. It enables you to assign an alias to any command or set of commands by giving them a new name of your choice. These aliases can save time by reducing the number of keystrokes required to execute a command, or by enabling you to create shortcuts for complex commands that you use often. Aliases can be added to your .bashrc file to make them available every time you open a terminal session.

The cat command

The cat command in Linux is a simple and powerful tool that allows you to view and concatenate files. It is a standard utility on most Linux distributions and is commonly used to display the contents of a file to the command line. The command can also be used to concatenate text files or copy files to other locations.

The less command

The ‘less’ command in Linux is a pager program similar to ‘more’ command, but with additional features. It allows users to view files with large amounts of data page by page, which can be especially useful when dealing with lengthy text documents or logs. The command enables users to move forward or backward through the text, search for specific patterns or words, and even highlight text for future reference. Additionally, ‘less’ can be used to view compressed files such as tarballs or gzip archives without the need to first decompress them.

The tail command

The tail command is a frequently used command in Linux that allows users to view the end of a file. It is typically used to monitor log files and can also be used to track incoming data in real-time. The most common usage of the tail command is to print the last ten lines of a file, however, this can be adjusted by using the -n option. Additionally, the -f option can be used to continuously track a file as it is updated in real-time.

The wc command

The wc (word count) command in Linux is used to count the number of lines, words, and characters in a file or output. When executed, it displays the number of lines, words and characters for each file or the total count if more than one file is provided. It also has a number of options that allow for the counting of specific types of characters, such as bytes or characters in multibyte locales. The wc command is commonly used to provide a quick summary of the contents of a file or to monitor log files in real-time.

The grep command

The grep command in Linux stands for global regular expression print. It is a versatile command-line utility that is used to search for a specific string or a pattern in one or more files. The command is case-sensitive by default but can be made case-insensitive with the appropriate flag. In addition to searching for a string, the grep command can also extract matching lines from a file, display the line number of a match, and search for files that contain a specified pattern. It is a powerful tool for searching and manipulating large amounts of text efficiently.

The sort command

The Linux sort command is a powerful tool used to sort the contents of text files or data from standard input. It can sort files numerically or alphabetically based on any column or key. The sort command has several options to customize the sorting behavior, such as ignoring case, specifying a field separator, and allowing for reverse sorting. Furthermore, it can handle large files efficiently and can also merge pre-sorted files.

The uniq command

The uniq command is a powerful utility that is used on Unix and Unix-like operating systems to find and display unique lines in a file. This command filters all adjacent identical lines and outputs only one single line. It takes advantage of sorted input files where each line is unique which makes it a key tool in any data analysis pipeline. The uniq command is robust and widely used, and it typically serves as an initial step in pre-processing data for later analysis, or as a tool in a larger pipeline that may include other utilities.

The diff command

The diff command in Linux is used to compare two files line by line and display the differences between them. It is commonly used to compare a modified file with its original version or to compare two different versions of a file. The output of the diff command shows the changes made to the files, including added, removed, or modified lines. This command also supports options to ignore white spaces and to display the differences side by side.

The echo command

The echo command in Linux is a built-in command that is used to display a line of text or a string on the terminal window. It is a simple command used extensively in shell scripts and batch files to display messages or variables. One can use the echo command to print a string, a number or to concatenate multiple strings and display them. It can also be used to redirect the output to a file using the redirection operator.

The chown command

The “chown” command, short for “change owner”, is used in Unix and Unix-like systems to change the ownership of a file or directory. The ownership of a file typically includes the username and group that have access to the file, as well as the permissions that apply to the file. By using the “chown” command, you can adjust these settings as needed to ensure that the right people have access to a given file or directory. This command is particularly useful for system administrators who need to control file access across multiple users and groups.

The chmod command

The chmod command is a commonly used command in UNIX and Linux operating systems that sets permissions on files and directories. It is used to specify which users have what kind of access to a file or directory. There are three types of permissions that can be granted: read, write, and execute. chmod can be used to set these permissions for the owner of the file, the group that the file belongs to, and all other users. The chmod command is a powerful tool that can help you control access to your files and directories and is a key component of UNIX/Linux security.

The umask command

The umask command is a tool used in Unix-based systems to set permissions for newly created files and directories. It works by subtracting the umask value from the default permissions for newly created files and directories. The resulting permissions determine the access that different users and groups have to the newly created files and directories. The default umask value is usually set to 022, allowing group members and other users to read files but preventing them from writing or executing them. The umask value can be changed using the umask command, which accepts numeric or symbolic notation.

I hope you had a great time lerning about the different commands used in linux.

Access Set 2 of the Linux Commands for DevOps by clicking HERE

Access the complete DevOps series by clicking HERE

Leave a Reply

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