Linux For Devops: A Simple Guide

Introduction
Linux plays a key role in the world of DevOps, where development and operations teams work together to deliver software faster and more efficiently. As a free, open-source operating system, Linux is the backbone of many DevOps tools and processes. Its flexibility, stability, and security make it a favorite for running servers, automating tasks, and managing cloud infrastructure. In this Blog, we will explore How to set up a Linux server, Introduction of shell Scripting, commands.
A Simple Overview of Linux History
Linux was created in 1991 by Linus Torvalds as a free operating system. It quickly grew with contributions from many developers around the world. Today, Linux is used on everything from computers to smartphones. It has different parts like the kernel, shell, and file system that work together to make it function.
Types Of Operating system
Operating systems (OS) are the backbone of all computing devices, allowing users to interact with hardware and run software.
1. Windows: is a popular operating system developed by Microsoft. It is widely used on personal computers.
2.macOS: is preferred by many creative professionals for tasks like graphic design, video editing, and music production.
3.Linux: is an open-source operating system that is free to use and can be customized to suit different needs. It is known for being secure, stable, and flexible.
Linux comes in many different flavors or distributions (distros), each designed for specific use cases, preferences, or tasks. These flavors are based on the core Linux operating system but offer different features, tools, and user experiences. Here are some of the most popular Linux flavors: Ubuntu, Fedora, CentOS, Debian.
Linux Architecture: A Simple Explanation
Linux architecture is made up of several key components that work together to run the operating system efficiently. Here’s a breakdown:
Kernel :The kernel is the core of Linux, responsible for managing the system’s resources, like memory and processing power.
Shell : The shell is the command-line interface that allows users to interact with the system.
Applications : Linux supports different types of applications like MySQL, docker, Kubernetes.
4 Ways to Set Up Linux for DevOps: Simple and Effective Approaches
1. Installing on Bare Metal (Physical Server)
This method involves installing Linux directly on a physical machine (a server or PC). It's ideal for creating dedicated servers for DevOps tasks like running CI/CD pipelines, databases, or web servers.
2. Using Virtual Machines (VMs)
You can create virtual servers using software like VirtualBox, VMware, or KVM. VMs allow you to run multiple Linux servers on a single physical machine, each isolated from the others.
3. Using Cloud Services (AWS, Azure, Google Cloud)
Cloud providers like AWS, Azure, and Google Cloud offer pre-configured Linux server instances. You can quickly create Linux environments to run DevOps tools without needing physical hardware.
6. Using Windows Subsystem for Linux (WSL)
For Windows users, WSL lets you run a Linux environment directly on Windows without needing a virtual machine or dual boot. It’s useful for developers who want to run Linux commands and tools from their Windows machine.
sudo : Your shortcut to powerful system commands.
When using Linux, there are times when you need special permissions to complete certain tasks, such as installing programs or modifying system settings. This is where the command sudo comes in.
What is sudo?
The word sudo stands for "superuser do". It's a command that lets you run tasks that normally require administrative (root) access. In simple terms, it temporarily gives you permission to perform tasks that are usually restricted to the system's administrator.
How Does sudo Work?
When you type a command with sudo, the system checks whether you have the necessary permissions to perform that task. If you're authorized, it lets you execute the command with admin rights, and you might be asked to enter your password to confirm.
For example:
sudo apt-get update
File Management in Linux
File management in Linux involves organizing, storing, and accessing files and directories (folders) on your system. Here’s a simple breakdown of how it works:
1. Understanding Directories and Files
In Linux, everything is a file—whether it’s a document, program, or even a device like your mouse.
2. Basic File Commands
Here are some basic commands to help manage files in Linux:
ls
: Lists files and directories in the current directory.
ls
cd
: Changes the current directory
cd /path/to/directory
3.pwd
: Displays the path of the current directory.
pwd
4.cp
: Copies files or directories.
cp source_file destination_file
5.mv
: Moves or renames files or directories.
mv old_file new_file
6.rm
: Removes (deletes) files or directories.
rm file_name
7.mkdir
: Creates a new directory.
mkdir new_directory
Permissions and Ownership:
Linux uses permissions to control who can read, write, or execute a file. Every file has an owner and a group, and different users may have different levels of access.
1.chmod
: Changes file permissions.
chmod 755 file_name
2.chown
: Changes file ownership.
chown user:group file_name
Finding Files:
Sometimes it’s hard to find a specific file, but Linux provides ways to search for them.
1.find
: Finds files based on specific criteria (e.g., by name or type).
find /path -name filename
2.locate
: Quickly searches for files by name.
locate filename
Advanced Linux commands:
1.awk
: is a powerful text processing tool. It's like a mini-programming language that helps you work with columns of data in files.
awk '{print $1}' file.txt
2.grep
: is a tool for searching specific text patterns within files. It's used to find lines that contain a certain word, phrase, or pattern.
grep "hello" file.txt
3.sed
is used for editing and transforming text directly in files.
sed 's/oldtext/newtext/' file.txt
Linux volumes: The building blocks of storage, organizing your data efficiently :
In Linux, a volume refers to a section of storage space (like a hard drive, SSD, or USB drive) that has been formatted and mounted to store data. It is typically a partition or a logical storage unit that the operating system uses to organize files.
key points :
1.Mounting: A volume must be mounted for the system to access and use it. Mounting is the process of making a storage device available at a specific location in the file system.
2.File Systems: Volumes are formatted with a file system (like ext4, NTFS, or FAT) which organizes data in a structured way.
3.Partitions: A physical disk can be divided into partitions, and each partition can be treated as a separate volume.
How to see volumes:
You can use commands like lsblk
or df
to list all available volumes and check their usage.
Command example :
lsblk
Conclusion
To build a successful career in DevOps, mastering Linux is essential. Its reliability, flexibility, and deep integration with DevOps tools make it a cornerstone for automation, server management, and efficient deployment pipelines. A strong grasp of Linux will empower you to optimize processes, scale systems, and excel in modern development practices.
Subscribe to my newsletter
Read articles from aishwarya kamthe directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
