随笔分类 -  shell

摘要:需求如下:有个文件aaaa,内容如下:[代码]我想提取出来还有"mm"的行的行号,方法总结如下:方法一:[代码]方法二:[代码]方法三:说明:第一个< 是定向 第二个<()是进程替换 阅读全文
posted @ 2011-02-09 16:11 sunss 阅读(3970) 评论(0) 推荐(0)
摘要:在工作中,我需要把远程服务器上的文件,拷贝到本地,可是scp的时候必须输入密码,用here文档又不能实现,终于找到一个好东东,expect ,可以实现自动登录,我们可以借助expect在ssh,ftp,scp等地方实现自动登录,加入到脚本中,可以自动完成一些事情,先把我的测试通过的脚本贴出来:Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->#!/bin/bashfor i in a b cdo/usr/bin/expect<<EO 阅读全文
posted @ 2010-12-23 13:47 sunss 阅读(1482) 评论(0) 推荐(0)
摘要:strace-vps-e2>ps.txt 阅读全文
posted @ 2010-09-10 14:33 sunss 阅读(586) 评论(0) 推荐(0)
摘要:cat/proc/<pid>/statm|awk'{printf"%dm\n",$1/1024}' 阅读全文
posted @ 2010-09-10 14:32 sunss 阅读(361) 评论(0) 推荐(0)
摘要:原文地址:http://www.linuxshell.cn/html/66/t-166.html方法一:#!/bin/sh#监控CPU使用率#Written by Chameleon#Http://chameleon.icpcn.comscriptdir=/root/shell/cpu_jklogdir=$scriptdir/logif [ -d $logdir ]thenecho "$logdi... 阅读全文
posted @ 2010-09-09 14:52 sunss 阅读(738) 评论(1) 推荐(0)