"Day 2: Essential Linux Commands for DevOps Beginners - Exploring cd, pwd, ls, and mkdir"
Welcome to Day 2 of the 90-Day DevOps Challenge! As you embark on your journey to mastering DevOps practices, understanding the fundamentals of working within a Linux environment is crucial. Today, we delve into four essential commands that form the backbone of navigating and manipulating files and directories in Linux: cd, pwd, ls, and mkdir.
Whether you're completely new to Linux or looking to refresh your knowledge, mastering these commands will lay a solid foundation for your DevOps endeavors. From moving between directories to listing file contents and creating new directories, these commands are indispensable tools for efficient system navigation and management.
In this blog post, we'll explore each command in detail, discussing its purpose, usage, and practical examples. By the end of this guide, you'll have a firm grasp of these fundamental Linux commands, setting the stage for more advanced DevOps concepts ahead. Let's dive in!
# Basic linux commands
1) ls command
- ``ls`` --> The ls command is used to list files or directories in Linux and other Unix-based operating systems.
- ``` ls -l ```--> Type the ls -l command to list the contents of the directory in a table format with columns including.
Column 1- content permissions
Column 2- number of links to the content
Column 3- owner of the content
Column 4- group owner of the content
Column 5- size of the content in bytes
Column 6,7,8 -last modified month / date / time of the content
Column 9 - file or directory name
- ```ls -a ```--> Type the ls -a command to list files or directories including hidden files or directories. In Linux, anything that begins with a (.) is considered a hidden file.
- ```ls *.sh*``` --> here act as wildcard entry , if we have to list out files ending with .sh we simply use \ before .sh
- ```ls -i ``` --> List the files and directories with index numbers in oders
- ``` ls -d /*``` --> Type the ls -d* / command to list only directories.
2) pwd command
- ```pwd``` --> It gives the present working directory path where you are currently present.
3) Change Directory commands
- ```cd path_to_directory``` --> Change directory to the provided path.
- ```cd ~ ``` or just ```cd ``` --> Change directory to the home directory.
- ``` cd - ``` --> Go to the last working directory.
- ``` cd ..``` --> Chnage directory to one step back.
- ``` cd ../..``` --> Use ls ../.. for contents of two levels previous directories.
4) mkdir command
- ``` mkdir directoryName``` --> Use to make a directory in a specific location
e.g mkdir New_folder
- ``` mkdir .Hidden_dir1 ``` --> Make a hidden directory (always use . before a file to make it hidden)
- ```mkdir A B C D ``` --> Make multiple no of directories at the same time.
- ```mkdir -p babuBhaiya/Raju/Shyam ``` --> Make a nested directory where babuBhaiya is a parent directories for Raju & Shyam directories.
"Embrace the power of these foundational Linux commands, and watch your DevOps skills soar! Stay tuned for Day 3 as we delve deeper into the world of DevOps essentials." Happy blogging!!!