Table of contents
Welcome to Day-2 of the #90DaysOfDevOps challenge, today we will be exploring and learning some basic Linux commands like Listing Commands and Directory Commands. These commands are crucial to managing Files and Folders in Linux systems. Let's dive into these commands along with some examples.
Listing Command
The ls
command is used to list down all files, directories, and subdirectories in the present working directory.
let's look at ls along with various flags and some examples:
ls [option flag] [arguments]
ls -l
: This command is used to list the files and directories in a long list format with extra information like Permission, Owner, Size, and Modification date.-
ls -a
: It lists all files and directories including hidden files and directories that start with a dot (.). -
ls *.sh
: It lists down all the files with the .sh extension, it is used when a user wants to filter based on some specific pattern. ls -i
: It lists files and directories along with their index number(inodes).-
ls -d */
: It lists only directories that is allowing the user to view the directory structure without files and you can also specify a pattern to narrow down the output.
Directory Commands
pwd:
This command prints the Present Working Directory.-
cd path_to_directory
: This command changes the current path to provided path of a directory. -
cd ~ or just cd
: This command changes the directory to the home directory. -
cd -
: It allows you to go back to the last working directory. -
cd ..
: This command allows you to back one step backward in the directory structure. -
cd ../..
: This command allows you to move two steps backward in the directory structure. -
mkdir directoryName
: This command is used to make a directory. Here are some examples. mkdir newFolder # Creates a new folder named 'newFolder' mkdir .NewFolder # Creates a hidden directory (prefixing with a dot) mkdir A B C D # Creates multiple directories at the same time mkdir /home/user/Mydirectory # Creates a new folder in a specific location mkdir -p A/B/C/D # Creates a nested directory structure
Congratulations! We've learned some of the basic Linux commands for listing files and directories, navigating through directories, and creating new folders. T
Stay tuned for Day 3 of the #90DaysOfDevOps challenge, where I'll explore more advanced Linux commands and their practical applications.
Connect with me on Twitter, Linkedin, and Github.
If you found this blog post helpful, please consider sharing it with others who might benefit from it and share your valuable feedback.