Hunter的大杂烩 技术学习笔记

March 9, 2006

一些经验

Filed under: 闲聊 — hunter @ 2:10 pm

netstat -an|awk ‘{print $5}’|sort |uniq -d -c | sort > c
察看哪个ip连接最多

Gcc 2.95.x下
C struct结构不能大于600M
否则sizeof(struct)会不准确
C array的大小不能大于300M
否则 array[offset] 会coredump

宏类型是不检查的,所以
Printf(“%s”, __LINE__);
是可以编译成功,但是会core dump的
正确是
Printf(“%d”, __LINE__);

删除无引用的shm
ipcs -m | awk ‘/root/ {if($6==0) system(sprintf(“ipcrm shm %s”,$2));}’
ipcs -m | egrep “^0x”|sort|awk ‘{printf(“%s %s\n”, $1,$6); }’
ipcs | gawk ‘{if($6==0){print “ipcrm -m ” $2}}’ | sh

删除某行内的字符
sed -e ‘s/xxx//g’ kk > bb

No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

Powered by WordPress