Skip to main content

Command Palette

Search for a command to run...

Basic Commands & structure Overview

Updated
8 min readView as Markdown
Basic Commands & structure Overview

Online Linux Terminal and Playground for Practice

The LabEx Online Linux Terminal offers a comprehensive online Linux terminal and sandbox environment, providing users with a full Linux experience without local setup requirements. This versatile platform caters to Linux beginners, system administrators, and developers alike, offering an ideal space for exploration and experimentation with various Linux technologies.

https://labex.io/tutorials/linux-online-linux-playground-372915🧾 Essential Linux Commands Every DevOps Engineer Must Know (Beginner-Friendly)

“If you can’t use the terminal, you can’t be a DevOps engineer.”
That might sound intense — but it’s true.

The Linux terminal is your main tool. Whether you’re configuring servers, running cloud deployments, or troubleshooting errors, the terminal is where everything happens.

Let’s break down the must-know Linux commands for beginners — explained in plain English, with real-world DevOps context, so you don’t just memorize — you understand.


🛠️ 1. pwd – Print Working Directory

This command tells you where you are inside the system.

pwd

🧠 Think of it like asking: “What folder am I currently in?”


📂 2. ls – List Files

Lists the contents of the current directory.

ls

Useful flags:

  • ls -l: Shows details like permissions, size, date

  • ls -a: Shows hidden files (those starting with a dot)

🧠 In DevOps: You’ll use this daily when navigating logs, config files, deployments, etc.


🧭 3. cd – Change Directory

Move between folders.

cd /etc/nginx/
  • cd .. → Go up one level

  • cd ~ → Go to your home directory


📖 4. cat, less, and tail – Read Files

These commands help you read logs and config files.

cat nginx.conf       # See full file at once  
less nginx.conf      # Scroll through it interactively  
tail nginx.log       # See the last 10 lines

Bonus:

tail -f nginx.log    # Live view (updates in real-time)

🧠 Tail is used a lot when debugging services in DevOps.


🧑‍🔧 5. sudo – Run as Superuser (Admin)

Run commands with administrator permissions.

sudo apt update
sudo systemctl restart nginx

🧠 You’ll often need sudo to install software or restart services.


⚙️ 6. apt, yum, or dnf – Package Managers

Used to install, update, and remove software.

For Ubuntu/Debian:

sudo apt update
sudo apt install nginx

For CentOS/RHEL/Rocky:

sudo yum install nginx
# or
sudo dnf install nginx

🧠 This is how you install tools like Docker, Ansible, Git, etc.


📁 7. mkdir, rm, mv, and cp – File Management

Basic file operations you’ll use every day:

mkdir logs            # Create a directory
rm file.txt           # Delete a file
mv file.txt /backup/  # Move file
cp file.txt copy.txt  # Copy file

🧠 These are like drag-and-drop — but with power and speed.


👤 8. chmod and chown – Permissions & Ownership

Used to secure files and set correct access.

chmod 755 script.sh         # Set permission
chown ubuntu:ubuntu file    # Change ownership

🧠 You’ll use this when deploying secure apps or managing SSH access.


🔍 9. grep – Search Inside Files

Search for specific text (super useful for log files).

grep "error" /var/log/nginx/error.log

🧠 In DevOps, you’ll often grep logs to find error messages or trace bugs.


📋 10. ps, top, and kill – Monitor and Manage Processes

ps aux           # List running processes
top              # Live CPU/memory usage
kill 1234        # Kill process with PID 1234

🧠 Helpful when a service hangs or uses too much memory.


🔁 Bonus: Combine Commands with Pipes (|)

ps aux | grep nginx

This finds all nginx-related processes. Pipes let you chain commands together — extremely useful in automation and debugging.


🔄 Summary Table: Quick Reference

CommandPurpose
pwdShow current directory
ls -lList files with details
cdChange directory
cat/less/tailView file contents
sudoRun command as admin
apt / yumInstall and update software
mkdir / rmCreate or delete files/folders
chmod / chownSet permissions and ownership
grepSearch inside files
ps / topView running processes
killStop a running process

🎯 Final Thoughts

You don’t need to memorize all of these right away. Start small. Practice one at a time on your Linux system.

But here’s the deal:

You only need about 20% of Linux commands to do 80% of DevOps work — and these are that 20%.


💡 Coming Up Next:

In the next section, we’ll cover:

👉 Linux File System Structure: How Everything is Organized (For DevOps)
We’ll explain the magic of /etc, /var, /opt, /home, /bin, and more — so you know where things live on a Linux machine and why that matters in automation and deployments.

🗂️ Linux File System Structure Explained (For DevOps Beginners)

When you first open a Linux terminal, it can feel a bit overwhelming.
You type ls / and boom — a bunch of mysterious folders show up:

]bin  boot  dev  etc  home  lib  opt  proc  root  sbin  tmp  usr  var

You might think:

“Wait… where’s C:\ drive? Where’s Downloads? What is all this?!”

Don’t worry — this guide will demystify the Linux file system and show you what lives where — and why it matters for DevOps.


📌 Why This Is Important for DevOps

In DevOps, you’ll constantly deal with:

  • Configuration files

  • System logs

  • Service binaries

  • Deployments and scripts

If you don’t know where to find things — or where to put things — you’ll waste hours and make critical mistakes.

Let’s break it all down — plain and simple.


🏠 Linux File System: Root / Is Everything

In Linux, everything starts from the root directory: /

There are no drives like C: or D:. Everything is part of a single tree — with / at the top.


🔍 Major Directories You Should Know (with Real Examples)

📁 /bin — Essential User Binaries

  • Contains basic command-line programs.

  • These work even in emergency/recovery mode.

🧠 Examples: ls, cat, mkdir, cp, mv, rm


🔧 /sbin — System Binaries

  • Similar to /bin, but for administrative commands.

🧠 Examples: reboot, shutdown, systemctl, iptables


🛠️ /etc — Configuration Files (Very Important!)

  • Every service you install puts its config files here.

🧠 Examples:

  • /etc/nginx/nginx.conf → Web server config

  • /etc/ssh/sshd_config → SSH server settings

  • /etc/crontab → Scheduled tasks

As a DevOps engineer, you’ll live in /etc.


🏡 /home — User Home Directories

  • Every non-root user has a personal folder here.

🧠 Example:

  • /home/devops/ → User “devops” home

Think of it like “My Documents” on Windows or “Users” on macOS.


⚙️ /opt — Optional Software Packages

  • Used for manually installed or 3rd-party applications.

🧠 You might install tools like Prometheus, Grafana, or custom apps here.


📦 /var — Variable Data (Logs, Caches, Mail, etc.)

  • Stores system logs, spool files, and data that changes frequently.

🧠 Important for DevOps:

  • /var/log/ → Logs live here

  • /var/www/ → Default web server content folder (Apache/Nginx)


🧪 /tmp — Temporary Files

  • Files that are automatically deleted after a reboot or timeout.

🧠 Use it for temporary testing, but don’t store anything important here.


🧍 /root — Root User’s Home Directory

  • Personal folder for the root user (admin).

🧠 It’s like /home/root, but for superuser.


🧠 /usr — User Software and Data

  • One of the largest directories.

  • Stores most installed programs, libraries, and docs.

🧠 Examples:

  • /usr/bin → Non-essential user programs

  • /usr/local → Locally compiled apps (e.g., built from source)


🖥️ /dev, /proc, /sys — System Internals

These are virtual directories that represent hardware and kernel processes.

🧠 DevOps Tip:
You might use /dev/null to discard output:

some_command > /dev/null 2>&1

🎯 Quick Summary Table

DirectoryPurpose
/Root of the file system
/bin, /sbinCore system binaries
/etcConfig files for all services
/homeUser directories
/optOptional/manual apps
/varLogs, cache, web content
/tmpTemp files
/usrUser-level binaries & docs
/rootAdmin (root) home folder
/dev, /proc, /sysSystem internals

🧠 Why This Matters in Real DevOps Work

  • Want to check why your app isn’t running? You’ll check logs in /var/log/.

  • Need to change server config? Head to /etc/.

  • Writing a deployment script? You’ll decide: put it in /usr/local/bin, or /opt/yourapp/.


🧰 Real DevOps Task Example:

Let’s say you’re deploying a web app with Nginx:

sudo nano /etc/nginx/sites-available/app.conf    # config file
sudo ln -s /etc/nginx/sites-available/app.conf /etc/nginx/sites-enabled/
sudo systemctl restart nginx

Knowing where to place configs and where logs go is critical — and all of it ties back to understanding the file system.


🏁 Final Thoughts

Don’t try to memorize all of this in one go.
Instead, explore your Linux VM:

cd /
ls
cd /etc
ls -l

Just start browsing and observing. You’ll get familiar faster than you think.

Linux Unlocked: From Basics to DevOps Mastery

Part 2 of 7

“Linux Unlocked” is a comprehensive article series designed for aspiring DevOps engineers and system administrators. Starting from the very basics of Linux, this series gradually progresses to advanced topics tailored for real-world DevOps practices.

Up next

Getting Started with the Linux Command Line: Essential Commands & Bash Basics

Online Linux Terminal and Playground for Practice The LabEx Online Linux Terminal offers a comprehensive online Linux terminal and sandbox environment, providing users with a full Linux experience without local setup requirements. This versatile plat...

More from this blog

T

The DevOps Playbook

7 posts