qwqg

FreeBSD的技巧

查看服务器的80端口的连接数
netstat -nat|grep -i "80"|wc -l

用下面命令察看哪些服务在运行
netstat -na --ip
netstat -na |grep LIST
lsof -i:端口

查看软件安装的位置
 pkg_info –L *** | less

查看这个软件的具体信息
 pkg_info ***

安装lsof程序时需要
install  /quark/qwqg/lsof_4.59/lsof /usr/sbin/lsof
source /root/.cshrc

将man 命令的输入结果导入到TXT文件中
man | col -b > file.txt

在bge0网卡上增加ip别名:
ifconfig bge0 add alias 192.168.64.80  netmask 255.255.255.255 up 

在bge0网卡上删除ip别名:
ifconfig bge0 -alias 192.168.64.80

说明:这里掩码的设定是这样的,同一个网段的第一个ip掩码按照真实的掩码设置。在这个网段下面再增加ip时,掩码就是255.255.255.255了

查看多少个独立IP访问网站
netstat -an |grep tcp |awk '{print $5}' |awk -F: '{print $1}' |sort |uniq |wc -l

下面命令可以分别计算当前目录下的文件和目录个数:
ll * |grep "^-"|wc -l ----- to count files
ll * |grep "^d"|wc -l ----- to count dir

只列子目录
ll -F | grep /$

在当前目录下搜索文件内带system的关键字
grep -r system *

在vi中替换字符的命令:
:g/abc/s//def/

如何从一个大tgz包中解压出某个文件
gunzip -dc file.tar.gz | tar tf -
可以看包里面的文件
然后用
gunzip -dc file.tar.gz | tar xf - file1 file2
其中file1 file2是你要解出来的文件。这个方法因为用的是stdout和pipe, 不需要占用多少的临时磁盘空间。

在系统上查看用户php程序执行时间长短;正常执行时间为0.1s
date ; php -f index.php date

posted on 2005-07-04 12:52 qwqg 阅读(253) 评论(0)  编辑 收藏 引用

只有注册用户登录后才能发表评论。