设为首页 加入收藏

TOP

10个你闻所未闻的Linux命令(十)
2011-07-05 17:55:36 】 浏览:14715
Tags:闻所未闻 Linux 命令
 
  • 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,谢谢!

    首页 上一页 7 8 9 10 下一页 尾页 10/10/10
    】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
    上一篇使用shell搜索文本的几种方法 下一篇关于Linux下C/C++开发的入门

    最新文章

    热门文章

    Hot 文章

    Python

    C 语言

    C++基础

    大数据基础

    linux编程基础

    C/C++面试题目