find . -name "*.tar" -exec mv {} ./backup \;
# 延伸:刪除 30 天前、超過 100MB 的 .log 文件
find . -name "*.log" -mtime +30 -type f -size +100M | xargs rm -rf
for i in $(find . -name "*.zip" -type f); do
unzip -d "$i" /data/www/img/
done
# 刪除行首字符
sed -i 's/^.//g' test.txt
# 行首插入 a
sed 's/^/a/g' test.txt
# 行尾插入 a
sed 's/$/a/g' test.txt
# 匹配行後追加 c
sed '/pattern/ac' test.txt
# 匹配行前插入 c
sed '/pattern/ic' test.txt
# 修改包含 SELINUX 的行:enforcing -> disabled
sed -i '/SELINUX/s/enforcing/disabled/' /etc/selinux/config
if [ ! -d /data/backup/ ]; then
mkdir -p /data/backup/
else
echo "The Directory already exists,please exit"
fi
while sleep 5m; do
for i in $(df -h | sed -n '/\/$/p' | awk '{print $5}' | sed 's/%//g'); do
if [ $i -ge 90 ]; then
echo "More than 90% Linux disk space, Please Check!" | \
mail -s "Warn Linux / Parts is $i%" barlow@toxingwang.com
fi
done
done
cat access.log | awk '{print $1}' | sort | uniq -c | sort -nr | head -20
# 正確做法:去除多余空格後排序,取首尾行
sed 's/ */ /g' a.txt | sort -nr | sed -n '1p;$p'
snmpwalk -v2c -c public 192.168.0.241
sed -e 's/jk$/yz/g' b.txt
# 抓取 192.168.56.7 經 80 端口的包
tcpdump -nn host 192.168.56.7 and port 80
# 排除 192.168.0.22 的 80 端口
tcpdump -nn host 192.168.56.7 or ! host 192.168.0.22 and port 80
TCP/IP 七層模型:物理層 → 數據鏈路層 → 網絡層 → 傳輸層 → 會話層 → 表示層 → 應用層。
Linux 文件權限管理:touch、chmod 與權限位深度解析
Squid 透明代理完整部署指南:從核心編譯到 iptables 轉向實戰
Linux I/O 多路複用三雄對決:select vs poll vs epoll 核心機制、效能與適用場景深度比較
Linux 文本處理利器:sort 與 uniq 完整參數與實戰範例
Linux 系統安全管理十大實戰技巧:從文件系統屬性到蜜罐部署
Sublime Text 3 Build 3019 新功能亮點:跳轉編輯位置、HTML 自動完成增強、視網膜顯示優化、大檔案載入加速、API 擴展