If you're looking to level up your Linux command line skills, here’s a curated list of advanced Linux commands, tools, and techniques, categorized by functionality:
🔍 File and Text Processing
-
awk
awk '{print $2, $1}' file.txt
-
Powerful for pattern scanning and processing.
-
-
sed
sed -E 's/([0-9]{3})/\1-/' file.txt
-
Stream editor for modifying files or inputs inline.
-
-
xargs
find . -name '*.log' | xargs grep 'ERROR'
-
Converts input from stdin into arguments to a command.
-
-
cut
,paste
,tr
,sort
,uniq
,tee
cut -d':' -f1 /etc/passwd | sort | uniq
🧠 System Monitoring and Performance
-
htop
/atop
/glances
-
Interactive process viewers.
-
-
iotop
-
Shows disk I/O by process.
-
-
strace
strace -p <PID>
-
Traces system calls of a process.
-
-
lsof
lsof -i :80
-
Lists open files and ports.
-
-
watch
watch -n 2 df -h
-
Repeats a command at intervals.
-
📁 Disk & Filesystem Tools
-
ncdu
-
Visual disk usage analysis.
-
-
df
,du
du -sh * | sort -h
-
mount
,umount
,lsblk
,blkid
🧰 Networking & Sockets
-
netstat
/ss
ss -tuln
-
nmap
nmap -sV 192.168.1.1
-
tcpdump
tcpdump -i eth0 port 80
-
curl
,wget
,nc
(netcat)curl -I https://example.com nc -vz google.com 80
🔐 Permissions, Security, & Users
-
chmod
,chown
,setfacl
,getfacl
-
sudo
,visudo
-
usermod
,groupadd
,passwd
-
ssh
,scp
,rsync
rsync -avz /local/dir/ user@host:/remote/dir/
🔄 Automation and Scripting
-
cron
,at
crontab -e
-
Shell scripting:
for i in *.log; do gzip "$i"; done
-
trap
,set -euo pipefail
for robust scripts.
📦 Package Management
-
Debian/Ubuntu:
apt
,dpkg
-
Red Hat/CentOS:
yum
,dnf
,rpm
-
Arch:
pacman
🧠 Cool Pro Tips
-
Brace expansion:
mkdir -p project/{src,bin,doc}
-
Process substitution:
diff <(ls dir1) <(ls dir2)
-
Command chaining:
cmd1 && cmd2 || echo "cmd1 failed"
-
Parallel execution with
&
andwait
:cmd1 & cmd2 & wait
If you want a focused guide (e.g. for networking, performance tuning, or scripting), just let me know!
No comments:
Post a Comment