Screen
我 的 host 是 Ubuntu 10.04 , 而我的 guest 是 RHEL 5.4 . 由于我的小黑只有 1G 的内存 , 所以每次开启 Vbox , 在 Vbox 下操作 RHEL , 机子都卡的不行了 . 后来就想直接在我这台 host 上 ssh 到我 guest 里面的 RHEL : 最开始的时候是一个 Gnome Terminal 开四个标签 : pts/0 ssh 到...
View ArticleOpenSSL:Basic
查看 openssl 的版本 $ openssl version $ openssl version -a $ openssl ciphers -v base64 编码 $ openssl enc -base64/-a -in file.txt $ openssl enc -base64 -in file.txt -out file.txt.enc $ echo "encode me" |...
View ArticleSimpleHTTPServer in Python
这个 Python 模块真是太好用了! Python 2.5 以上的均支持 SimpleHTTPServer 模块,使用很简单,在你需要共享的文件目录下执行: $ python -m SimpleHTTPServer 8000 默认是 8000 端口,你也可以改成其他大于 1024 的端口,要使用 1024 以下的就要 root 权限了。 CentOS 默认的 INPUT 链是 DROP,记得开放:...
View Articleexpr
该命令是在跟 @lifanxi 商量筹划 NanjingLug Ubuntu Release Party 的过程中学到的,在此记录,顺便把 Linux 下常用的计算工具总结一下。 man 手册的第一句话就知道了这个 expr 的由来:evaluate expressions。经实验,只能支持一些简单的运算,加了括号就会出现语法错误。 字符串操作 $ expr length...
View Articleexec/xargs in find
查找当前目录下以 anaconda 开头的文件,并查找其中的 evince 字符串 # find . -name "anaconda*" -exec grep -i evince {} \; 查找当前目录下的 install.log 文件,并做 md5 校验 # find . -name "install.log" -exec md5sum {} \; 查找 /var/log 下的 error...
View Article收集的一些 grep/sed/awk 范例
$ cat datafile Steve Blenheim:238-923-7366:95 Latham Lane, Easton, PA 83755:11/12/56:20300 Betty Boop:245-836-8357:635 Cutesy Lane, Hollywood, CA 91464:6/23/23:14500 Jose Santiago:385-898-8357:38 Fife...
View ArticleThe Advanced Usage of Sed
这里总结的是 sed 的“高级”用法,主要集中在 patten space 和 hold space。 注意:在进行一些文本处理前,需要注意文本行数的奇偶性,这个会影响到最终的结果。 首先描述下 sed 这个流编辑器的工作流程: 1.从标准输入/文件中读取一行 2.去除改行的换行符\n 3.将该行放入 pattern buffer(模式空间,或者 patten space) 4.根据 sed...
View Articleiftop
Ubuntu 和 CentOS 可用各自的包管理器安装: # yum install iftop ncurses-devel # apt-get install iftop libncurses5-dev 下面是几个常用的参数。 iftop 在没有使用 -i 指定的情况下,默认会使用 eth0 作为监控的接口。 以一台 nat 为例来说明 iftop 的用法,默认 eth1 配置私网 IP,eth0...
View Articlenethogs 以及 jnettop 的使用
nethogs 可以用来监控进程消耗的带宽,而 jnettop 则使用来记录每个 IP 的带宽的使用情况。 nethogs 安装很简单,通过包管理工具均可安装: # apt-get install nethogs # yum install nethogs 使用也很简单,使用 root 执行: # nethogs ethx 使用 m...
View Articlesar 的图形化
用了这么多小巧的监控工具,发现还是 sar 最强大,系统级别的 metric 是应有尽有,不管是实时的秒级监控还是历史数据,对分析近期(比如前一天或者前几天)出现的问题非常有帮助,这比不管是 Zabbix,Nagios 之类的「系统」要强大的多,典型的开相即用的好工具。默认是 10min 一次数据,这个不能完全满足我们的需求,目前我们有部分机器将 interval 缩小到了 1min...
View Article