Essential Linux Commands for Efficient File and Directory Management
Are you new to Linux or looking to enhance your command-line skills? Mastering basic commands for navigating and organizing files and directories is crucial. Let's dive into some essential Linux commands that will help you become more proficient in managing your system.
Understanding Directory Listings
ls Command:
ls: Lists all files and directories in the current folder.
ls -l: Shows detailed information about files and directories in a long list format.
ls -a: Displays all files, including hidden ones (those starting with a dot
.
).ls *.sh: Lists files with names ending in
.sh
(shell scripts).ls -i: Lists files and directories along with their inode numbers (unique identifiers).
ls -d */: Shows only directories within the current directory.
Navigating Directories:
Directory Navigation:
pwd: Displays the path of the current directory (Present Working Directory).
cd path_to_directory: Moves to the specified directory path.
cd ~ or just cd: Takes you back to your home directory.
cd -: Returns to the previous directory you were in.
cd ..: Moves up one directory level (parent directory).
cd ../../: Jumps up two directory levels.
Creating Directories:
mkdir directoryName: Creates a new directory in the current location.
mkdir .NewFolder: Makes a hidden directory (starting with a dot).
mkdir A B C D: Creates multiple directories at once.
mkdir /home/user/Mydirectory: Makes a directory in a specific path.
mkdir -p A/B/C/D: Creates nested directories recursively.
Subscribe to my newsletter
Read articles from Pankaj Chaudhari directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Pankaj Chaudhari
Pankaj Chaudhari
Experienced Software Engineer with over 1 year of expertise in backend development, microservices architecture, and cloud-native applications. Skilled in Java, Spring Boot, AWS, Docker, and Kubernetes. Proficient in deploying, scaling, and managing applications. Ready to contribute technical excellence to collaborative software development teams.