🐧 Revisiting the Basics: Linux Commands & Networking Concepts 🌐
Today, I spent some time revising Linux commands and networking concepts that we frequently use in our day-to-day IT operations.
While working in Operation Support, we often use these commands to investigate issues, monitor applications, check server health, and troubleshoot connectivity problems.
I thought of bringing some of these commonly used commands and concepts together in one place. It will be helpful not only for me to refresh my memory but also for anyone who wants to revisit the basics.
Here are some of the topics I covered. 👇
📂 1. Important Linux Directories
-
/home→ User files and personal directories. -
/etc→ System configuration files. -
/var→ Logs and frequently changing data. -
/usr→ Applications and libraries. -
/tmp→ Temporary files. -
/proc→ Information about running processes and the kernel.
📍 2. Basic Navigation Commands
-
pwd→ Check the current directory. -
ls→ List files and directories. -
cd→ Change directory. -
.→ Current directory. -
..→ Parent directory. -
~→ Home directory.
📁 3. File and Directory Management
-
mkdir -p→ Create directories. -
touch→ Create an empty file. -
cp→ Copy files and directories. -
mv→ Move or rename files. -
rm -rf→ Remove files/directories recursively and forcefully (use with caution). -
rmdir→ Remove empty directories. -
cat→ Read file contents. -
less/more→ Read large files page by page. -
head→ View the first 10 lines. -
tail→ View the last 10 lines. -
tail -f→ Monitor log files continuously. -
grep→ Search for specific words or patterns. -
find→ Search for files and directories. -
wc -l→ Count the number of lines.
🗜️ 4. Compression and Archiving
-
tar→ Create and extract archives. -
gzip/gunzip→ Compress and decompress files. -
zip/unzip→ Create and extract ZIP files.
⚙️ 5. Linux Service Management
Using systemctl:
-
systemctl status nginx→ Check service status. -
systemctl start nginx→ Start a service. -
systemctl stop nginx→ Stop a service. -
systemctl restart nginx→ Restart a service. -
systemctl enable nginx→ Enable automatic startup. -
systemctl disable nginx→ Disable automatic startup.
🌐 6. Networking Commands
These are some of the commands I find particularly useful during troubleshooting:
-
ip addr→ Check server IP addresses. -
ip route→ Check routing information. -
ping→ Check basic network connectivity. -
nslookup/dig→ Check DNS resolution. -
curl→ Test URLs, HTTP responses, and APIs. -
ss -tulpn→ Check listening ports. -
nc -zv hostname port→ Check connectivity to a specific port. -
traceroute→ Trace the network path to a destination. -
netstat→ Check network connections and listening ports.
📦 7. Package Management (APT)
-
sudo apt update→ Refresh the package index. -
sudo apt upgrade→ Upgrade installed packages. -
sudo apt install nginx→ Install an application. -
sudo apt remove nginx→ Remove an application. -
sudo apt autoremove→ Remove unused dependencies.
🐚 8. Bash Scripting
Bash scripting is one of the useful ways to automate repetitive activities in Production Support.
A few basics:
-
#!/bin/bash→ Specifies the script interpreter. -
chmod +x script.sh→ Makes the script executable. - Variables → Store values.
- Functions → Reuse code.
- Conditions → Execute commands based on certain conditions.
- Loops → Automate repetitive tasks.
-
vi/nano→ Create and edit scripts.
For example, we can automate log checks, file validations, service health checks, and application monitoring.
🔐 9. Remote Server Connectivity
Common protocols and ports:
- FTP → 20, 21
- SSH / SFTP / SCP → 22
- Telnet → 23
Useful commands:
-
ssh user@host→ Connect to a remote server. -
ssh-keygen→ Generate SSH keys. -
ssh-copy-id→ Copy the public key to a remote server. -
scp→ Securely transfer files. -
rsync→ Synchronize files and directories.
🔗 10. Pipes, Redirection and Command Chaining
One thing I like about Linux is how easily we can combine multiple commands to get the required output.
Some practical examples:
-
ps aux | grep nginx→ Find Nginx-related processes. -
tail -f app.log | grep -i error→ Monitor error messages in real time. -
ls > files.txt→ Save command output to a file. -
echo "Done" >> deploy.log→ Append information to a log file. -
command1 && command2→ Execute the second command only if the first succeeds. -
command1 || command2→ Execute the second command if the first fails.
🚨 11. Network Troubleshooting – A Practical Approach
Whenever an application becomes slow or unreachable, the first assumption should not be that the server is down.
The issue could be related to DNS, network connectivity, firewall rules, application services, or backend dependencies.
A few checks I generally consider:
- 🔍 DNS – Is the hostname resolving correctly?
- 🌐 Connectivity – Can we reach the destination?
- 🔌 Port – Is the required port accessible?
- ⚙️ Service – Is the application service running?
- 📡 HTTP – What response code is the application returning?
- 🛡️ Firewall – Is any traffic being blocked?
For checking HTTP response codes and response time:
curl -s -o /dev/null -w "Status: %{http_code} | Time: %{time_total}s\n" https://hostname
🔌 12. Commonly Used Ports
- 22 → SSH
- 25 → SMTP
- 53 → DNS
- 80 → HTTP
- 443 → HTTPS
- 1521 → Oracle Database
- 1433 → Microsoft SQL Server
- 5432 → PostgreSQL
- 3306 → MySQL
- 27017 → MongoDB
- 3389 → RDP
🌍 13. HTTP and HTTPS
Whenever we access a website or interact with an API, HTTP/HTTPS helps establish communication between the client and server.
Common HTTP Methods:
- GET → Retrieve data.
- POST → Submit or create data.
- PUT → Update a resource.
- PATCH → Partially update a resource.
- DELETE → Delete a resource.
HTTP Status Codes:
- 1xx → Informational.
- 2xx → Success.
- 3xx → Redirection.
- 4xx → Client-side errors.
- 5xx → Server-side errors.
🔒 HTTPS uses TLS encryption to secure communication between clients and servers.
🛡️ 14. Firewalls
A firewall controls incoming and outgoing network traffic based on predefined security rules.
Some important concepts:
- 📥 Inbound Traffic → Traffic coming into a server.
- 📤 Outbound Traffic → Traffic going out from a server.
- ✅ Allow Rules → Permit specific traffic.
- 🚫 Deny Rules → Block specific traffic.
- 🔐 Least Privilege → Allow only the access that is actually required.
⚖️ 15. Load Balancers
A load balancer distributes incoming application traffic across multiple backend servers instead of sending everything to a single server.
Some important benefits:
- ⚖️ Traffic distribution.
- ❤️ Backend health checks.
- 🚀 High availability.
- 🔄 Failover support.
- 📈 Better scalability.
These concepts are widely used in cloud environments, Kubernetes, and modern application architectures.
💡 My takeaway:
Sometimes, revisiting the basics is just as important as learning new technologies.
In Production/Application Support, a good understanding of Linux, networking, and troubleshooting fundamentals can save valuable time during critical incidents.
📚 Keep learning, keep practicing, and keep strengthening the fundamentals!