Day 6 of 100 Days of DevOps: Exploring Essential Linux Commands 🐧
"Aspiring DevOps Engineer on a 100-day journey to master the principles, tools, and practices of DevOps. Sharing daily insights, practical lessons, and hands-on projects to document my path from beginner to proficient. Passionate about continuous learning, automation, and bridging the gap between development and operations. Join me as I explore the world of DevOps, one day at a time!"
Welcome to Day 6! Today, we’re diving into core Linux commands that every DevOps professional should know. By the end of this post, you’ll have practiced file management, system navigation, and even some basic troubleshooting.
Ready? Let's get started! 💪
Part 1: File & Directory Management 📁
Where am I?
Usepwdto print your current working directory. This helps you know where you are in the Linux filesystem:pwdSee it All!
List everything (including hidden files) withls -a. Hidden files can contain configurations or settings:ls -aCreate Nested Directories
Need to set up a folder structure? CreateA/B/C/D/Ein one go with the-pflag. Try it out:mkdir -p A/B/C/D/EChange Directories
Move to a directory usingcd. Let’s navigate toA/B/C:cd A/B/CMake and Break a Directory
First, create a folder calledTestDir:mkdir TestDirThen remove it using
rmdir(only works if empty):rmdir TestDirCreate a File
Usetouchto make an empty file namedexample.txt. This is handy for setting up new files or updating timestamps:touch example.txtCopy and Move Files
Copyexample.txtto a new file namedexample_copy.txt:cp example.txt example_copy.txtThen rename it using
mv:mv example_copy.txt example_moved.txtFinally, delete it:
rm example_moved.txt
Part 2: File Viewing & Editing 📄
View File Content
Usecatto display everything inexample.txt:cat example.txtNeed to Scroll?
For larger files,lesslets you scroll through content one page at a time:less example.txtGet a Sneak Peek
Useheadto show the first 10 lines ortailfor the last 10:head example.txt tail example.txtEditing Time!
Openexample.txtwithnanoorvim, two popular text editors. You’ll get familiar with both over time:nano example.txt vim example.txt
Part 3: Permissions & Ownership 🔐
Adjust Permissions
Want to set permissions?chmod 744gives the owner read, write, and execute permissions, and read-only for others:chmod 744 example.txtChange Owner
Usechownto assign a new owner and group:chown user:group example.txtDetailed Listing
Check out file permissions and ownership withls -l:ls -l
Part 4: System Monitoring & Management 📊
What’s Running?
Thetopcommand shows live processes, sorted by usage. Useqto quit:topDetailed Process List
ps auxprovides more detailed info about all running processes:ps auxDisk and Directory Usage
Check available disk space withdf -h:df -hAnd use
du -sh .to see the size of your current directory:du -sh .Memory and Uptime
free -hshows memory usage in a human-readable format:free -huptimelets you know how long the system has been running:uptime
Additional Handy Commands 🛠️
Here are a few more must-know commands to boost your productivity:
Command Shortcuts
Make shortcuts withalias. For example, turnls -lainto a quickll:alias ll='ls -la'Search Within Files
Look for specific text inside files usinggrep:grep "search_term" example.txtFind Files
Locate files by name withfind:find /path/to/search -name "filename"Archive Files
Compress a directory withtar. This example creates a.tar.gzarchive:tar -czvf archive.tar.gz /path/to/directoryDownload Files
Grab files from the internet withwget:wget http://example.com/file.zipData Transfer
Fetch a file usingcurl:curl -O http://example.com/file.zipGet Help
Not sure about a command? Check the manual withman:man ls
Conclusion
These commands are the backbone of Linux system management. Practicing them regularly will make you comfortable with navigating and managing your environment.
Keep sharing your progress and questions in the comments, and let’s continue learning together. Happy learning!