1.xargs和exec详解
xargs
exec
find /var/log/ -type f -mtime +10 (超过10天的文件)
find /var/log/ -type f -mtime +10 -exec cp {} {}.bak \; (将找到的文件都复制成.bak文件)
find /var/log/ -type f -mtime +10 |xargs -i cp {} {}.1 (复制重命名)
ls |xargs
ls x*
ls x* |xargs rm
ls x*
ls *.txt
ls *.txt |xargs -i cp {} {}.bak
ls *.txt*
2.screen命令
nohup sleep 100 &
cat nohup.out
jobs
yum install -y screen
screen(进入虚拟终端)
top
Ctrl+a+b 退出,隐藏后台
screen -ls
screen
vmstat 1
Ctrl+a+b
ps aux |grep -E ‘top|vmst‘
w
ps aux |grep screen
screen -ls
screen -r 1630 (进入指定的ID终端)
Ctrl+b 或esc 真正断开
screen -ls
screen -r
esc
screen -ls
screen -S test1 (改名)
top
Ctrl+a+b
screen -ls
screen -r test1 (等同于 screen -r ID)
3.curl命令
curl www.aminglinux.com(HTML源码)
curl -I !$ (查看HTML状态码)
常见状态码: 200 301 302 404 403 502 503
curl -I www.lishiming.net
vim /etc/hosts(插入 192.168.1.1 www.qq.com)
ping www.qq.com
curl www.qq.com
vim /etc/hosts(注释掉刚加入的)
ping www.qq.com
(-x表示代理)
curl -x61.135.157.156:80 www.qq.com -I
ping www.baidu.com
curl -x61.135.169.125:80 www.baidu.com
curl -Iv www.qq.com(查看访问信息)
curl -u username:password http://www.qqq.com
curl -o http://www.baidu.com/imp/bdlogo.png (后面跟的是网页图片地址)
curl -o baidu.png
http://www.baidu.com/imp/bdlogo.png
ls baidu.png
wget http://www.baidu.com/imp/bdlogo.png (下载图片)