
The Linux terminal is a powerful tool for efficiently performing tasks such as system administration, file management, and network configuration.
In this guide, I’ve listed the most essential Linux commands along with usage examples. Bookmark it — it will come in handy!
1️⃣ File and Directory Operations
📁 Show current directory:
pwd
🔹 Displays the current working directory.
📂 List directory contents:
ls -l
🔹 Lists files with detailed information.
📂 Change directory:
cd /home/user
🔹 Navigates to the specified directory.
📂 Create a new directory:
mkdir new_folder
🔹 Creates a new folder.
📂 Delete a directory and its contents:
rm -r old_folder
🔹 Deletes the folder and all its contents.
2️⃣ File Management
📄 Create a new file:
touch new_file.txt
🔹 Creates a new, empty file.
📄 View file content:
cat file.txt
🔹 Displays the contents of the file.
📄 Edit a file:
nano file.txt
🔹 Opens the file in the nano editor.
📄 Delete a file:
rm file.txt
🔹 Deletes the specified file.
📄 Move or rename a file:
mv old_name.txt new_name.txt
🔹 Renames or moves the file.
3️⃣ User and Permission Commands
👤 Check current user:
whoami
🔹 Shows the logged-in username.
🔑 Switch to root user:
sudo su
🔹 Temporarily gains root privileges.
🔒 Change file permissions:
chmod 755 file.txt
🔹 Sets read, write, and execute permissions.
4️⃣ Network and Connectivity
🌍 View IP address:
ip a
🔹 Lists network interfaces and IP addresses.
🌍 Ping a server:
ping google.com
🔹 Tests connectivity to a server.
🌍 Check network connections:
netstat -tulnp
🔹 Displays open ports and active services.
5️⃣ System Administration
⚙️ List running processes:
top
🔹 Shows current processes and CPU usage.
⚙️ Shut down system:
sudo shutdown -h now
🔹 Immediately powers off the system.
⚙️ Restart system:
sudo reboot
🔹 Reboots the system.
⚙️ Check disk usage:
df -h
🔹 Displays used and available disk space.
Related Articles
