Shell奇技淫巧

1,054 views
874 views

Published on

Published in: Technology
0 Comments
8 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,054
On SlideShare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
24
Comments
0
Likes
8
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Shell奇技淫巧

    1. 1. Shell奇技 巧 David Xie david.xie@me.com
    2. 2. 导读奇技的前奏检查文件内容文件行数/字数检查文件内容替换
    3. 3. 奇技的前奏
    4. 4. 管道|ps -ewf | grep mac
    5. 5. 重定向>>><ls > file.lstecho “xxx.xxx.xxx.xxx” >> /etc/hostsmysql -U root -p < test.sql
    6. 6. awkawk -F “ ” ‘{print $1,$2}’
    7. 7. sed-i 原地替换‘s/original/new/g’sed -i “” ‘s/class/CLASS/g’ <FILE>
    8. 8. xargs对前面结果的每一行做处理ps -ewf | grep daimaduan.com | awk‘{print $2}’ | xargs kill -9
    9. 9. 好戏 始 !
    10. 10. 检查文件内容find src/ -name ‘*.py’ -type f-name, -type, -user, -group, -size
    11. 11. 检查文件内容find src/ -name ‘*.py’ -type f |xargs grep -n -i ‘copyright’
    12. 12. 文件行数/字数检查wc -w <FILE>wc -l <FILE>find src/ -name ‘*.py’ | xargs wc -l
    13. 13. 文件内容替换find protected/ -name *.php | awk -F ":" {print $1} | xargs sed -i ""s/class/CLASS/g

    ×