April 29, 2025 - 12:43
Basic Terminal Commands and Usage in Linux Image
Linux

Basic Terminal Commands and Usage in Linux

Comments

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:

BASH
pwd

🔹 Displays the current working directory.

📂 List directory contents:

BASH
ls -l

🔹 Lists files with detailed information.

📂 Change directory:

BASH
cd /home/user

🔹 Navigates to the specified directory.

📂 Create a new directory:

BASH
mkdir new_folder

🔹 Creates a new folder.

📂 Delete a directory and its contents:

BASH
rm -r old_folder

🔹 Deletes the folder and all its contents.


2️⃣ File Management

📄 Create a new file:

BASH
touch new_file.txt

🔹 Creates a new, empty file.

📄 View file content:

BASH
cat file.txt

🔹 Displays the contents of the file.

📄 Edit a file:

BASH
nano file.txt

🔹 Opens the file in the nano editor.

📄 Delete a file:

BASH
rm file.txt

🔹 Deletes the specified file.

📄 Move or rename a file:

BASH
mv old_name.txt new_name.txt

🔹 Renames or moves the file.


3️⃣ User and Permission Commands

👤 Check current user:

BASH
whoami

🔹 Shows the logged-in username.

🔑 Switch to root user:

BASH
sudo su

🔹 Temporarily gains root privileges.

🔒 Change file permissions:

BASH
chmod 755 file.txt

🔹 Sets read, write, and execute permissions.


4️⃣ Network and Connectivity

🌍 View IP address:

BASH
ip a

🔹 Lists network interfaces and IP addresses.

🌍 Ping a server:

BASH
ping google.com

🔹 Tests connectivity to a server.

🌍 Check network connections:

BASH
netstat -tulnp

🔹 Displays open ports and active services.


5️⃣ System Administration

⚙️ List running processes:

BASH
top

🔹 Shows current processes and CPU usage.

⚙️ Shut down system:

BASH
sudo shutdown -h now

🔹 Immediately powers off the system.

⚙️ Restart system:

BASH
sudo reboot

🔹 Reboots the system.

⚙️ Check disk usage:

BASH
df -h

🔹 Displays used and available disk space.

Related Articles

Comments ()

No comments yet. Be the first to comment!

Leave a Comment