๐Ÿง Linux & Shell Scripting for DevOps Engineers : Part - 1๐Ÿš€

Ajinkya GiriAjinkya Giri
3 min read

๐Ÿ”น Introduction

Linux and Shell Scripting are essential skills for any DevOps Engineer. From automation to deployment, they play a crucial role in streamlining processes and ensuring efficiency in software development and infrastructure management.

Let's dive into the fundamentals of Linux, Shell Scripting, Bash Basics, and Common Commands that every DevOps Engineer should know! ๐Ÿ› ๏ธ


๐Ÿ”น What is Linux?

Linux is an open-source, Unix-like operating system that powers servers, cloud platforms, and DevOps tools. It offers stability, security, and flexibility, making it the preferred OS for DevOps and system administrators.

๐Ÿ”ฅ Why is Linux Important in DevOps?

โœ”๏ธ Most cloud services (AWS, Azure, GCP) run on Linux.
โœ”๏ธ Supports automation tools like Docker, Kubernetes, Ansible, Terraform.
โœ”๏ธ Provides powerful scripting capabilities for automation.
โœ”๏ธ Secure and customizable environment for deployments.


๐Ÿ”น What is Shell Scripting?

A shell script is a program written in Bash or other Unix shell languages that automates repetitive tasks. It executes a series of commands in a structured manner.

๐Ÿ“Œ Why Use Shell Scripting?

๐Ÿ”น Automates system tasks (file management, backups, log monitoring).
๐Ÿ”น Improves efficiency by reducing manual work.
๐Ÿ”น Helps in server provisioning and deployments.
๐Ÿ”น Integrates with DevOps tools for CI/CD pipelines.


๐Ÿ”น Use of Shell Scripting in DevOps

Shell scripting is widely used in DevOps for:

โœ… CI/CD Pipelines: Automating builds, testing, and deployments.

โœ… Infrastructure Automation: Managing servers, containers, and cloud services.

โœ… Configuration Management: Ensuring system configurations are up-to-date.

โœ… Monitoring & Logging: Automating system monitoring and log analysis.

โœ… Backup & Recovery: Automating backup jobs and disaster recovery plans.


๐Ÿ”น Basic Linux Commands ๐Ÿ–ฅ๏ธ

Here are some essential commands every DevOps engineer should know:

๐Ÿ“ File & Directory Management

๐Ÿ“Œ ls โ€“ List files and directories
๐Ÿ“Œ pwd โ€“ Show current directory path
๐Ÿ“Œ cd โ€“ Change directory
๐Ÿ“Œ mkdir new_folder โ€“ Create a new folder
๐Ÿ“Œ rm -rf folder_name โ€“ Delete a folder

๐Ÿ“‘ File Operations

๐Ÿ“Œ touch file.txt โ€“ Create an empty file
๐Ÿ“Œ cat file.txt โ€“ View file contents
๐Ÿ“Œ echo "Hello" > file.txt โ€“ Write to a file
๐Ÿ“Œ cp file1.txt file2.txt โ€“ Copy a file
๐Ÿ“Œ mv file1.txt new_location/ โ€“ Move or rename a file


๐Ÿ”น Working with vim

vim is a powerful text editor in Linux, commonly used for editing configuration files and scripts.

๐Ÿ“Œ Basic vi Commands

โœ”๏ธ Open a file: vi filename

โœ”๏ธ Insert mode (editing text): Press i

โœ”๏ธ Save changes & exit: Press Esc , type :wq! and press Enter

โœ”๏ธ Exit without saving: Press Esc type :q! and press Enter

โœ”๏ธ Undo last change: Press u

โœ”๏ธ Delete a line: Press dd


๐Ÿ”Ž Searching & Monitoring

๐Ÿ“Œ grep "error" logfile.log โ€“ Search for text in files
๐Ÿ“Œ find /home -name "*.log" โ€“ Find files by name
๐Ÿ“Œ ps aux โ€“ Display running processes
๐Ÿ“Œ top โ€“ Monitor system performance
๐Ÿ“Œ df -h โ€“ Check disk space usage
๐Ÿ“Œ free โ€“ Display memory usage
๐Ÿ“Œ free -g โ€“ Show memory usage in GB
๐Ÿ“Œ nproc โ€“ Display the number of available processors
๐Ÿ“Œ man <command> โ€“ Display the manual for a command


๐Ÿ”น Conclusion ๐ŸŽฏ

Mastering Linux and Shell Scripting is a must for every DevOps Engineer. It helps in automation, configuration management, and optimizing deployment pipelines.

By learning: โœ”๏ธ Linux basics & commands โ€“ You can navigate and manage systems efficiently.
โœ”๏ธ Shell scripting โ€“ You can automate tasks and improve workflow.
โœ”๏ธ DevOps applications โ€“ You can build scalable and reliable CI/CD pipelines.

๐Ÿ’ก Keep practicing, automate tasks, and become a DevOps pro! ๐Ÿš€


โœ‰๏ธ Got questions? Drop them in the comments! Let's learn together. ๐Ÿ”ฅ

0
Subscribe to my newsletter

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

Written by

Ajinkya Giri
Ajinkya Giri

๐Ÿš€ Aspiring DevOps Engineer | Computer Engineering Student ๐ŸŒ Passionate about bridging the gap between development and operations, I am a computer engineering student with a keen interest in DevOps, automation, and cloud computing. I thrive on optimizing workflows, implementing CI/CD pipelines, and exploring the latest DevOps tools to enhance software deployment and scalability. ๐Ÿ”น Tech Interests: DevOps, Cloud Computing (AWS/Azure/GCP), Kubernetes, CI/CD, Infrastructure as Code ๐Ÿ”น Skills in Progress: Linux, Git, Docker, Terraform, Python/Bash scripting ๐Ÿ”น Goal: To master DevOps methodologies and contribute to seamless software delivery ๐Ÿš€ Always eager to learn, collaborate, and automate! ๐Ÿ’ก