常用linux命令 linux openwrt
#!/usr/bin/expect
spawn python uploader.zip
expect "APPID"
send "yourappid\r"
expect "Email"
send "youremail\r"
expect "Password"
send "yourpassword\r"
interact
openwrt中注意的事情:
1.npm 使用代理下载:
npm --https-proxy=http://proxy.company.com:8080 -g install karma
比如使用goagent代理下载 npm --https-proxy=http://127.0.0.1:8087 -g install gitbook
2.linux 查看文件encoding
file -bi filename
修改编码: iconv -f gb2312 -t utf8 filename -o filename.new
3.vim 删除匹配到字符串的行
:g/string/d
删除不匹配的行 :g!/string/d
4.批量下载视频,然后上传到百度网盘:[其中百度网盘linux命令行项目,https://github.com/houtianze/bypy ]
for i in {1..2246};do echo "downloading " $i;axel `sed -n $i'p' a.txt` -o $i.flv;baidu upload $i.flv;rm $i.flv;done
5.linux文件编码转换,一般gb2312会出现乱码:
iconv -f gb2312 -t utf8 file -o newfile
6.linux 跳转目录
使用autojump命令.
7.下载视频并且上传到百度网盘
lines=`wc -l < $1`
for i in $(seq 1 $lines);do echo "downloading " $i " video";axel `sed -n $i'p' $1` -o $i.flv;python ~/tools/bypy/bypy.py upload $i.flv;rm $i.flv ;done
8.将文字转换为ascii 【命令使用:http://www.shellhacks.com/en/Creating-ASCII-Text-Banners-from-the-Linux-Command-Line】
echo "WTF?" | figlet -f banner
9.python自动去人人网发帖
renren.py 脚本在我自己gist中
for i in {1..3};do python renren.py "`sed -n $i'p' renrenpost.txt`";sleep 3600;done
10.linux ab压力测试命令
ab -c 20 -n