首页 > 代码库 > svn,git,scp,rsync,rake,ssh,wget,axel,aria2,nohup,grep,tail,siege,mitmproxy,ulimit,netstat,lsof

svn,git,scp,rsync,rake,ssh,wget,axel,aria2,nohup,grep,tail,siege,mitmproxy,ulimit,netstat,lsof

scp


把本地文件上传到server上

scp -P 1234 config/cert/dev/client.pem dev@xx.xxx.xxx:/srv/rorapps/fgcc/config/cert/production


把server数据传到本地

scp fgww:/srv/rorapps/fgcc/doc/yunying_20140601-20140601.csv ./


压缩传输

scp -C fgww:/srv/rorapps/fgcc/doc/yunying_20140601-20140601.csv ./

rsync

rsync -azcP huafei_search:/srv/rorapps/huafei2/log/production_20140618.log.bz2 ~/Workspace/test/huafei 


目录

scp -r fgww:/srv/rorapps/fgcc/doc/static ./


svn VS git 

svn

svn checkout server_url

svn status

svn diff  **file

svn add **file

svn commit -m "xxx"

svn update

git

git clone server_url

git status

svn diff  **file

git add -A

git commit -m "xxx"

git push origin master


svn 迁移到 git

svn to git

git svn clone http://svn.magus-soft.com/svn/movie/server/touch -s

git for-each-ref refs/remotes/tags | cut -d / -f 4- | grep -v @ | while read tagname; do git tag "$tagname" "tags/$tagname"; git branch -r -d "tags/$tagname"; done

git for-each-ref refs/remotes | cut -d / -f 3- | grep -v @ | while read branchname; do git branch "$branchname" "refs/remotes/$branchname"; git branch -r -d "$branchname"; done

git remote add origin git@git.funguide.com.cn:movie_java/touch.git

git branch -a

git push  origin ‘*:*‘

git push  origin --all

git push origin --tags


rake 

防止运行耗时操作时网络中断 nohup

nohup ./cmb_mplus_export_yunying.sh start_time=2014-06-03 end_time=2014-06-03 & [2] 23728


ssh

 ssh -vvv -N -L 5433/192.168.0.132/6435 -p 6521 menxu@**.**.**.** 

 ssh 无password登陆 http://cn.soulmachine.me//blog/20120102/

wget


usage: wget -i http://*
说明: http://*为下载文件网址及文件名称
example: wget -i http://xp6.yyxt.com/201201/GZOS_XP_1.1.iso


用axel加快下载速度

安装axel
apt-get install axel
执行axel
usage: axel -n 10 -o /tmp/ http://xp6.yyxt.com/201201/GZOS_XP_1.1.iso


aria2断点下载文件

apt-get install aria2
example: aria2c http://xp6.yyxt.com/201201/GZOS_XP_1.1.iso
分段下载:
example: aria2c -s 2 http://xp6.yyxt.com/201201/GZOS_XP_1.1.iso
断点下载:
example: aria2c -c http://xp6.yyxt.com/201201/GZOS_XP_1.1.iso
下载torrent文件
example: aria2c -o *.torrent http://*


nohup 任务


nohup rake pay_code:order_record start_time=2014-09-08 end_time=2014-09-08 &

使用 jobs 查看任务。

使用 fg %n 关闭



grep 查日志


grep 查找内容 日志文件

 -A50 向下50行

-B50 向上50行

-wc 统计

-E 查找匹配一组数据


tail -f 

 grep -o ‘cid=>[^,]*‘ tmp/dx_event_async_04121842.log |sort |uniq

grep --color -E ‘A|B|C‘ file.log

siege 压力測试

/usr/local/Cellar/siege/3.0.7_1/bin/siege -c 50 -r 100 http://xxxxxxxxxxxxxxxx/ticket/v4/callback/zhifu_callback


mitmproxy 代理分析请求完整的參数get/post

http://blog.csdn.net/menxu_work/article/details/44780001


ulimit 限制系统用户对shell资源的訪问

查看第三方请求连接数

ulimit -a/n


netstat  显示各种网络相关信息

如网络连接,路由表,接口状态 (Interface Statistics)。masquerade 连接,多播成员 (Multicast Memberships) 等等

看TCP的连接数
netstat -nap | grep tcp |wc -l


lsof 列出当前系统打开文件的工具

lsof |grep ‘test/test3‘
lsof -i :3306
lsof -i tcp:80

curl Access-Control-Allow-Origin 是 *,限定于 GET,POST,PUT

curl -X PUT -H "Origin: http://mendd.com" -Iv https://s3.cn-north-1.amazonams.com.cn/****.png




svn,git,scp,rsync,rake,ssh,wget,axel,aria2,nohup,grep,tail,siege,mitmproxy,ulimit,netstat,lsof