📘 Premium Read: Access my best content on Medium member-only articles — deep dives into Java, Spring Boot, Microservices, backend architecture, interview preparation, career advice, and industry-standard best practices.
✅ Some premium posts are free to read — no account needed. Follow me on Medium to stay updated and support my writing.
🎓 Top 10 Udemy Courses (Huge Discount): Explore My Udemy Courses — Learn through real-time, project-based development.
▶️ Subscribe to My YouTube Channel (172K+ subscribers): Java Guides on YouTube
1️⃣ ls – List Files and Directories 📂
✅ Overview
The ls
command lists all files and directories in the current directory. It helps users view content quickly and navigate the system efficiently.
📌 Example:
ls # List files in the current directory
ls -l # Detailed list with permissions, size, and modification date
ls -a # Show hidden files
2️⃣ cd – Change Directory 📁
✅ Overview
The cd
command allows users to navigate between directories with ease.
📌 Example:
cd /home/user/documents # Navigate to the 'documents' directory
cd .. # Move up one directory level
cd ~ # Move to the home directory
3️⃣ mkdir – Create New Directory 📂
✅ Overview
The mkdir
command is used to create new directories.
📌 Example:
mkdir my_folder # Create a new directory
mkdir -p parent/child # Create parent and child directories
4️⃣ rm – Remove Files or Directories 🗑️
✅ Overview
The rm
command is used to permanently delete files or directories.
📌 Example:
rm file.txt # Remove a single file
rm -r folder_name # Remove a directory and its contents
5️⃣ mv – Move or Rename Files 🔄
✅ Overview
The mv
command is used to move or rename files and directories.
📌 Example:
mv old_name.txt new_name.txt # Rename a file
mv file.txt /home/user/docs # Move a file to another directory
6️⃣ chmod – Change File Permissions 🔐
✅ Overview
The chmod
command is used to modify file or directory permissions.
📌 Example:
chmod 755 script.sh # Assign read, write, and execute permissions
chmod u+x script.sh # Grant execute permission to the user
7️⃣ cp – Copy Files or Directories 📑
✅ Overview
The cp
command is used to copy files or directories.
📌 Example:
cp file.txt /backup/ # Copy a file to another directory
cp -r folder_name /backup/ # Copy a folder and its contents
8️⃣ find – Search for Files 🔎
✅ Overview
The find
command is used to locate files and directories based on conditions.
📌 Example:
find /home -name "*.txt" # Find all .txt files in the /home directory
9️⃣ grep – Search for Patterns 📄
✅ Overview
The grep
command is used to search for specific patterns in files.
📌 Example:
grep "error" log.txt # Search for "error" in log.txt
grep -r "function" . # Recursively search in the current directory
🔟 vi – Edit Files ✏️
✅ Overview
The vi
command opens the vi editor to modify files.
📌 Example:
vi file.txt
# Tip: Use 'i' to insert text and ':wq' to save and exit.
1️⃣1️⃣ cat – Display File Contents 📜
✅ Overview
The cat
command displays the content of a file.
📌 Example:
cat file.txt # Display the contents of a file
1️⃣2️⃣ tar – Archive Files 📦
✅ Overview
The tar
command creates or extracts tarball archive files.
📌 Example:
tar -cvf archive.tar folder/ # Create an archive
tar -xvf archive.tar # Extract an archive
1️⃣3️⃣ ps – Display Process Information 🖥️
✅ Overview
The ps
command displays active processes.
📌 Example:
ps # List processes in the current shell
ps aux # List all processes with details
1️⃣4️⃣ kill – Terminate Processes ❌
✅ Overview
The kill
command terminates a process by its ID.
📌 Example:
kill 1234 # Terminate process with PID 1234
1️⃣5️⃣ top – Monitor System Resources 📊
✅ Overview
The top
command displays real-time system resource usage.
📌 Example:
top # Monitor system processes
1️⃣6️⃣ ifconfig – Configure Network Interfaces 🌐
✅ Overview
The ifconfig
command displays or configures network interfaces.
📌 Example:
ifconfig # Display network information
🔹 Note: Use ip addr
as a modern alternative.
1️⃣7️⃣ ping – Test Network Connectivity 📡
✅ Overview
The ping
command sends ICMP packets to test connectivity.
📌 Example:
ping google.com # Check connectivity to Google's servers
1️⃣8️⃣ du – Check Disk Usage 💾
✅ Overview
The du
command estimates file or directory space usage.
📌 Example:
du -h # Display file sizes in a human-readable format
du -sh folder/ # Summarize folder size
🎯 Conclusion
Mastering these 18 essential Linux commands equips you to navigate and manage Linux systems efficiently. Whether you’re a beginner or a seasoned developer, these commands are foundational for working in Linux environments.
💬 Which of these commands do you use the most? Let us know in the comments! 🚀
Comments
Post a Comment
Leave Comment