๐Ÿง Expand Your Linux Skills with These 5 Advanced Commands and Examples๐Ÿ–ฅ๏ธ๐Ÿง

Danish TamboliDanish Tamboli
3 min read

Mastering these Linux commands can make you feel like a real power user ๐Ÿ’ช. Letโ€™s explore top 5 advanced commands, what they do, and how they help in real-world situations.


1. ๐Ÿ” strace โ€“ Trace System Calls and Signals

๐Ÿ“ฆ What it does:
strace helps you see what a program is doing in the background, like reading files, writing data, or making system calls.

๐Ÿ› ๏ธ Real-life Example:
Your program is crashing, and you donโ€™t know why. Use strace to trace whatโ€™s going on behind the scenes.

strace ./my_app

๐Ÿ“Œ Youโ€™ll find out:

  • Which files are opened

  • Missing libraries

  • Permission errors

๐Ÿš€ Pro Tip:
Want to trace a running process?

strace -p 1234

Where 1234 is your process ID (PID).


2. ๐Ÿงช lsof โ€“ List Open Files

๐Ÿ“ฆ What it does:
Shows all open files by processes. In Linux, everything is a file โ€” ports, devices, logs!

๐Ÿ› ๏ธ Real-life Example:
You canโ€™t start your server on port 8080. Something is already using it?

lsof -i :8080

๐Ÿ“Œ Youโ€™ll find out:

  • Which process is using that port

  • The PID so you can kill it

  • Whether the port is TCP/UDP

๐Ÿš€ Pro Tip:
Find open files in a folder:

lsof +D /var/log

3. ๐Ÿ“Š htop โ€“ Interactive Process Viewer

๐Ÿ“ฆ What it does:
An advanced, colorful and interactive version of top. Monitor system performance and manage processes in real-time.

๐Ÿ› ๏ธ Real-life Example:
Your server is slow. Use htop to quickly check which process is eating all the CPU or RAM.

htop

๐Ÿ“Œ You can:

  • Sort processes by memory, CPU

  • Kill tasks with one key

  • Monitor load, uptime, cores

๐Ÿš€ Pro Tip:
Use arrow keys to navigate, F9 to kill a process.


4. ๐Ÿงฌ awk โ€“ Pattern Scanning & Text Processing

๐Ÿ“ฆ What it does:
awk is like a mini-programming language for manipulating text โ€” great for log files and reports.

๐Ÿ› ๏ธ Real-life Example:
You want to analyze Apache logs and get a list of all IPs.

awk '{print $1}' access.log

๐Ÿ“Œ You can also:

  • Do calculations: awk '{sum+=$2} END {print sum}' file.txt

  • Filter text: awk '$3 > 100' file.txt

๐Ÿš€ Pro Tip:
Combine with ps to extract useful data:

ps aux | awk '{print $1, $3, $11}'

Shows: user, CPU usage, and command.


5. ๐Ÿ›ก๏ธ iptables โ€“ Manage Firewall Rules

๐Ÿ“ฆ What it does:
Controls the incoming and outgoing network traffic using rules.

๐Ÿ› ๏ธ Real-life Example:
You want to allow SSH (port 22) but block everything else.

sudo iptables -A INPUT -p tcp --dport 22 -j ACCEPT
sudo iptables -P INPUT DROP

๐Ÿ“Œ Youโ€™ll be able to:

  • Open/close ports

  • Block IPs

  • Protect your server

๐Ÿš€ Pro Tip:
Check all rules with:

sudo iptables -L

โœ… Summary Table

๐Ÿ”ง Command๐Ÿ’ก Purpose๐Ÿ” Use Case Example
straceDebug system callsDebug why an app crashes
lsofShow open files/portsFind which app uses port 8080
htopMonitor performanceKill high CPU usage processes interactively
awkText processingExtract IPs from logs or filter large files
iptablesManage network/firewall rulesAllow SSH, block everything else

๐Ÿ Conclusion

Learning and using these advanced Linux commands can supercharge your productivity, help you troubleshoot faster, and give you greater control over your system. Whether youโ€™re managing a live server, analyzing logs, or debugging a stubborn error โ€” these tools are must-haves in your Linux toolbox. ๐Ÿงฐ๐Ÿง

โœจ Keep practicing and try combining commands in shell scripts to automate your tasks. The more you explore, the more powerful Linux becomes! ๐Ÿ’ป๐Ÿš€


0
Subscribe to my newsletter

Read articles from Danish Tamboli directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Danish Tamboli
Danish Tamboli