003 - Starting Your DevOps Journey: A Linux Guide

Hamza IqbalHamza Iqbal
3 min read

After the last blog, you might have realized how important it is for a DevOps engineer to have working knowledge of Linux, as most servers currently run on Linux. So, let's start with some basic information about it.

Folder Structure

Let's start with the basic folder structure of Linux. Here is the folder structure of Linux.

Image Credit: GeeksforGeeks

From the illustration above, you now have a foundational understanding of the Linux folder structure. Many Linux systems also include a /var directory, which houses logs in /var/log and cache files in /var/cache. Additionally, the /usr directory contains /bin and /local/bin directories. These were historically used as alternatives to /bin to address storage limitations, which are less of a concern today. However, they still exist and store command binaries. The /usr/local directory is used to store files for programs that have been installed. That's all you need to know about the basic folder structure.

Basic Linux Commands

Here are Basic Linux commands for file system management.

CommandDescription
lsLists the contents of a directory. with parameters like -a u can also view hidden files.
cdChanges the current directory. You can use it with relative path like ../ or absolute path like / from root.
pwdDisplays the current working directory path.
mkdirCreates a new directory.
rmdirRemoves an empty directory.
cpCopies files or directories.
mvMoves or renames files or directories.
rmRemoves files or directories.
touchCreates an empty file or updates the timestamp of an existing file.
catConcatenates and displays the content of files.
sudoto run any command as super user i.e. root you need to add sudo at start of the command.

Package Manager

Imagine installing software without an installer. You would need to manually place each file in the correct folder, and if there are dependencies, you would have to install each one by placing them in system folders yourself. To make this easier, we have package managers like Apt, Apt-get, or Snap. These are all package managers, and different operating systems have different ones. They automatically install and place the required dependencies and software in the correct folders. Now, let's talk about repositories. Package managers have sources where they search for the necessary packages or software to find and install. But what if the software you need isn't in the current repository? You can add repositories to the sources list, which is usually located at /etc/apt/sources.list for the Apt package manager.

I hope this article helps you understand the basics of Linux. Feel free to reach out to me if you have any questions.

Summary

This article covers the essential knowledge a DevOps engineer needs about Linux, focusing on its folder structure, basic file system management commands, and the role of package managers in software installation. Dive into the fundamental Linux directories and commands, essential for navigating and managing files, and explore how package managers like Apt and Snap simplify software installation and dependency management.

0
Subscribe to my newsletter

Read articles from Hamza Iqbal directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Hamza Iqbal
Hamza Iqbal

Hi, Hamza Iqbal here. I'm a MERN Stack developer with 3+ years of experience. I'm a tech enthusiast who love to learn new skills and read tech related news. Currently, I'm learning DevOps.