10个你从未用过的Linux命令

发表于:2011-7-07 10:13

字体: | 上一篇 | 下一篇 | 我要投稿

 作者:未知    来源:51Testing软件测试网采编

  8、col,想保存帮助页面为纯文本?

# PAGER=cat
# man less | col -b > less.txt

  9、xmlwf,需要知道一个XML文档或许是配置文件是否合理?

# curl -s 'http://bashcurescancer.com' > bcc.html
# xmlwf bcc.html
# perl -i -pe 's@<br/>@<br/>@g' bcc.html
# xmlwf bcc.html
bcc.html:104:2: mismatched tag

  10、lsof 列出打开文件,你可以用它做很多很cool的事情,比如查找哪个接口是开放的?

# lsof | grep TCP
portmap 2587 rpc 4u IPv4 5544 TCP *:sunrpc (LISTEN)
rpc.statd 2606 root 6u IPv4 5585 TCP *:668 (LISTEN)
sshd 2788 root 3u IPv6 5991 TCP *:ssh (LISTEN)
sendmail 2843 root 4u IPv4 6160 TCP badhd:smtp (LISTEN)
vsftpd 9337 root 3u IPv4 34949 TCP *:ftp (LISTEN)
cupsd 16459 root 0u IPv4 41061 TCP badhd:ipp (LISTEN)
sshd 16892 root 3u IPv6 61003 TCP badhd.mshome.net:ssh->kontiki.mshome.net:4661 (ESTABLISHED)
Note: OpenBSD 101 pointed out that “lsof -i TCP” a better way to obtain this same information. Thanks!Or find the number of open files a user has. Very important for running big applications like Oracle, DB2, or WebSphere:
# lsof | grep ' root ' | awk '{print $NF}' | sort | uniq | wc -l
179

  提示,匿名评论者指出应该用“sort -u”代替sort | uniq,本人忘记了-u flag,谢谢!

44/4<1234
《2023软件测试行业现状调查报告》独家发布~

关注51Testing

联系我们

快捷面板 站点地图 联系我们 广告服务 关于我们 站长统计 发展历程

法律顾问:上海兰迪律师事务所 项棋律师
版权所有 上海博为峰软件技术股份有限公司 Copyright©51testing.com 2003-2024
投诉及意见反馈:webmaster@51testing.com; 业务联系:service@51testing.com 021-64471599-8017

沪ICP备05003035号

沪公网安备 31010102002173号