Mastering Linux Commands: A Guide for DevOps Enthusiasts

Pratik ChavanPratik Chavan
2 min read

Introduction: As a DevOps practitioner, having a solid understanding of Linux commands is essential for efficient system management and automation. In this blog post, we will explore three fundamental Linux commands: checking the present working directory, listing files and directories (including hidden files), and creating nested directories. Let's dive in and enhance our command-line prowess!

  1. Checking Your Present Working Directory: To determine your present working directory in Linux, you can use the pwd command. "pwd" stands for "print working directory." Simply open your terminal and enter the following command:
bashCopy codepwd

The output will display the absolute path of the directory you are currently in, allowing you to navigate and work effectively within your file system.

  1. Listing Files and Directories (Including Hidden Files): To list files and directories in Linux, the ls command is your go-to tool. By default, it lists the contents of the current directory. However, if you want to include hidden files (files whose names start with a dot), you can use the -a option. To combine both functionalities, use the following command:
bashCopy codels -a

Executing this command will provide you with a detailed list of files and directories, including the hidden ones. You can explore their names, permissions, sizes, and other relevant information. Feel free to experiment with additional options like -l for a long listing format or -h for human-readable sizes.

  1. Creating a Nested Directory: Creating nested directories in Linux is a straightforward process. The mkdir command allows you to create directories, and by specifying the desired path, you can create nested directories as well. Let's assume we want to create a nested directory structure: A/B/C/D/E. Use the following command:
cssCopy codemkdir -p A/B/C/D/E

The -p option ensures that if any of the parent directories don't exist, they will be created automatically. This way, you can create a whole nested directory structure in one go.

Conclusion: Mastering Linux commands is a valuable skill for any DevOps practitioner. In this blog post, we explored three essential commands: pwd to check the present working directory, ls -a to list files and directories (including hidden files), and mkdir -p to create nested directories. By leveraging these commands effectively, you can navigate through the file system, inspect files and directories, and create complex directory structures with ease. Keep exploring more Linux commands to enhance your DevOps toolkit and streamline your workflows. Happy command-lining!

0
Subscribe to my newsletter

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

Written by

Pratik Chavan
Pratik Chavan