🚀 Shell Scripting Basics: A Beginner's Guide to Linux Commands and Concepts


Switching from Software Testing to DevOps has been an exciting journey—and one of the first major milestones has been learning Linux and Shell Scripting. In this article, I’ll share what I’ve learned so far—from understanding the Linux operating system to writing and executing basic shell scripts using everyday commands.
🧠 What is an Operating System (OS)?
An Operating System is the software that connects the user with the hardware. It manages everything—from running applications to handling memory, CPU, and devices like printers, keyboards, or disk drives.
🐧 Why Learn Linux?
Linux is widely used in servers, DevOps tools, cloud platforms, and CI/CD pipelines. Its advantages:
Efficient device management
Powerful memory and CPU management
Great for automation
Lightweight and open-source
🧩 What is the Kernel?
The Kernel is the core of any OS, especially Linux. It communicates directly with the hardware. Everything that happens on a system—whether it's allocating memory or scheduling CPU—is managed by the kernel.
Why is it important?
Without the kernel, the OS can’t talk to the hardware. It's like the heart of the system.
💻 Essential Linux Commands for Beginners
Here’s a quick reference of common Linux commands with their purpose:
📂 cd
, cd ..
, cd ../..
Used to navigate through directories.
cd
= change directorycd ..
= go one level upcd ../..
= go two levels up
🗺️ pwd
– Print Working Directory
Shows the current directory path you’re in.
💾 df -h
– Disk Free Space
Displays the available disk space in human-readable format (MB/GB).
📁 ls
, ls -ltr
– List Files
ls
: lists files in current directoryls -ltr
: lists with details, sorted by time
✍️ touch
– Create Empty File
Creates a new file without opening it.
📚 man
– Manual Pages
Displays the manual/help for any Linux command. Example: man ls
📝 vi
, vim
– Text Editors
vi
: basic text editor in Linuxvim
: improved version with more features
🏗️ mkdir
– Make Directory
Creates new folders/directories.
🔁 #!/bin/bash
– Shebang
Used at the top of shell scripts. Tells the system which interpreter to use (in this case, bash).
📢 echo
– Print to Terminal
Displays a message or variable value. Example: echo "Hello World"
💾 :wq!
– Save and Exit in vi
:wq!
= write changes and quit the file (used in vi
/vim
editors).
📖 cat
– View File Content
Displays the content of files directly in the terminal.
🚀 sh
, ./
– Run Shell Script
🔐 chmod
– Change File Permissions
Gives permission to user, group, or others.
Permissions:
Read = 4
Write = 2
Execute = 1
Example:chmod 755
script.sh
→ gives read, write, execute to user, and read-execute to group and others.
🕰️ history
– Command History
Shows the list of commands you’ve previously run.
✅ Summary
Mastering basic Linux and shell scripting is the foundation of DevOps. These commands and concepts help you:
Navigate systems
Automate tasks
Write effective scripts
Work smoothly in cloud/CI/CD environments
Subscribe to my newsletter
Read articles from Priyanshu Varma directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Priyanshu Varma
Priyanshu Varma
Hi, I'm a Software Quality Engineer transitioning into DevOps. For years, I've been obsessed with quality and process improvement, and now I'm applying that passion to infrastructure and operations. This blog is my digital notebook where I'll share tutorials, project breakdowns, and the occasional "aha!" moment. Let's learn and grow together!