DEV Community

Kanavsingh
Kanavsingh

Posted on

🚀 Day 2 of the #90DaysOfDevOps Challenge: Mastering Basic Linux Commands

Today, as part of the #90DaysOfDevOps challenge, I dived into the basics of Linux commands—a crucial skill for anyone in DevOps. Understanding how to navigate and manage files and directories in Linux is foundational for working with servers, cloud infrastructure, and automation.

Let’s walk through some of the commands I learned today and how they can help you in your DevOps journey.

📁 Listing Commands: ls
The ls command is used to list the contents of a directory. It’s one of the most frequently used Linux commands.

Syntax:
ls
ls -l: Lists files and directories in a long list format, showing details like permissions, size, and last modified date.
ls -a: Lists all files, including hidden ones (files starting with a dot).
ls *.sh: Lists all files with a .sh extension (shell scripts).
ls -i: Lists files and directories with their index numbers (inodes).
ls -d */: Lists only directories. You can also specify patterns to match.
Examples:

ls -l # Detailed list format
ls -a # Include hidden files
ls *.sh # List all shell script files
ls -i # List with inodes
ls -d */ # List directories only
📂 Directory Commands: pwd, cd, mkdir
Being able to navigate and create directories is vital in managing file systems.

  1. pwd
    pwd stands for Print Working Directory. It tells you the current directory you’re working in.
    pwd # Outputs the current directory path

  2. cd (Change Directory)
    The cd command is used to navigate between directories.

cd path_to_directory: Changes directory to the specified path.
cd ~ or just cd: Changes to the home directory.
cd -: Returns to the last working directory.
cd ..: Moves one directory up (back).
cd ../..: Moves two directories up.

Examples:

cd /home/user/Documents # Navigate to the Documents folder
cd - # Go back to the last working directory
cd .. # Move one directory back
cd ~/Projects # Navigate to Projects in the home directory

  1. mkdir (Make Directory)

The mkdir command is used to create new directories.
mkdir directoryName: Creates a directory with the specified name.
mkdir .directoryName: Creates a hidden directory (prefixing with . makes it hidden).
mkdir A B C D: Creates multiple directories at once.
mkdir /path/to/directory: Creates a directory at a specific location.
mkdir -p A/B/C/D: Creates nested directories in one command.
Examples:

mkdir newFolder # Create a folder named 'newFolder'
mkdir .hiddenFolder # Create a hidden folder
mkdir A B C # Create directories A, B, and C at once
mkdir /home/user/Docs # Create a folder at a specific location
mkdir -p A/B/C/D # Create nested directories

🔧 Why Learning Linux Commands Is Important in DevOps
In DevOps, automation and infrastructure management often involve using Linux servers, whether it's for deploying applications, managing containers, or setting up CI/CD pipelines. Understanding these basic Linux commands is a fundamental step in mastering infrastructure as code, managing servers, and working efficiently in a command-line interface (CLI) environment.

DevOps engineers frequently interact with Linux-based environments in cloud platforms like AWS and Azure, and these commands are a critical part of that workflow.

Key Takeaways from Day 2:

ls is your go-to command for listing files and directories.
pwd helps keep track of your current directory location.
cd lets you navigate the file system efficiently.
mkdir allows you to create new folders, including hidden and nested directories.
Mastering these Linux basics sets the foundation for working on more advanced tasks like automation, scripting, and managing infrastructure at scale.

What’s Next?
Tomorrow, I’ll dive deeper into file manipulation commands and explore how to manage files in Linux efficiently. Stay tuned as I continue documenting my journey through the #90DaysOfDevOps challenge.

If you're also participating or want to learn more about DevOps and Linux, feel free to connect and follow along! Let’s keep learning and growing together. đŸ’»

DevOps #Linux #Commands #Shell #Automation #Scaling #Infrastructure #AWS #CloudComputing #TrainWithShubham #ShubhamLondhe #LearningJourney #90DaysOfDevOps

Top comments (0)