Day Two: Exploring Basic Linux Commands -  The #90DaysOfDevOps Challenge

Day Two: Exploring Basic Linux Commands - The #90DaysOfDevOps Challenge

Welcome to Day 2 of the #90DaysOfDevOps challenge! Today, we dive into the world of Linux, an essential skill for any DevOps engineer.

Link to GitHub Repo for the challenge.

For Day two of the challenge, the following tasks were to be completed:

  1. Showcase the Linux command to Check your present working directory.

  2. Showcase the Linux command to List all the files or directories including hidden files.

  3. Showcase the Linux command to Create a nested directory A/B/C/D/E

Now, let's delve into the world of Linux.

What is Linux?

Linux is an open-source operating system kernel that forms the basis of many Unix-like operating systems. Known for its stability, security, and flexibility.

Now let's talk about some of the basic Linux commands, some of which will be needed for today's challenge.

Listing Commands

ls Command:

  • ls - list the subdirectories and files available in the present directory.

  • ls -l - list the files and directories in a long list format with extra information.

  • ls -a - list all files and directories, including hidden ones.

  • ls *.sh - list all files having an .sh extension.

  • ls -i - list files and directories with index numbers (inodes).

  • ls -d */ - list only directories.

Directory Commands

pwd Command:

  • pwd - print the present working directory.

cd Command:

  • cd path_to_directory - change the directory to the provided path.

  • cd ~ or just cd - change the directory to the home directory.

  • cd - - go to the last working directory.

  • cd .. - change the directory to one step back.

  • cd ../.. - change the directory to 2 levels back.

mkdir Command:

  • mkdir directoryName - make a directory in a specific location.

  • mkdir .NewFolder - make a hidden directory.

  • mkdir A B C D - make multiple directories at the same time.

  • mkdir /home/user/Mydirectory - make a new folder in a specific location.

  • mkdir -p A/B/C/D - make a nested directory.

Now, let's put some of these commands into practice.

1. Check your present working directory.

Here we will use the pwd command

2. List all the files or directories including hidden files.

Here we will use the ls -a command

3. Create a nested directory A/B/C/D/E

Here we will use the mkdir -p A/B/C/D/E

First we list the items in the directory to ensure the directory does not already exist.

We create the nested directory then we confirm that it has been created by listing all items in the directory again.

For clean-up purposes, we remove the directory and subdirectories we have created by running rm -r. The option -r makes it run recursively removing the subdirectories as well.

When we list the items in the directory again we can see it was deleted.

That concludes our journey for Day 2 of the #90DaysOfDevOps challenge. Today, we've learnt more about Linux and some of its fundamental commands. Stay tuned for more updates and insights as we progress through the #90DaysOfDevOps challenge together. Let's embark on this journey with enthusiasm, curiosity, and a shared passion for continuous learning.