【问题标题】:Change the of the output in lsof in linux在 linux 中更改 lsof 中的输出
【发布时间】:2013-12-01 12:12:11
【问题描述】:

我想用 lsof 获得不同的结果,我的意思是只想显示一些列, 有可能吗?

COMMAND     PID       USER   FD      TYPE             DEVICE  SIZE/OFF       NODE NAME
init          1       root  cwd       DIR                8,1      4096          2 /
init          1       root  rtd       DIR                8,1      4096          2 /
init          1       root  txt       REG                8,1     36992     139325 /sbin/init
init          1       root  mem       REG                8,1     14696     190970 /lib/libdl-2.11.3.so
init          1       root  mem       REG                8,1   1437064     190958 /lib/libc-2.11.3.so

【问题讨论】:

  • 将它传送到cut。有关详细信息,请参阅man cut。或者问一个更具体的问题,可能会显示你想要的输出和当前的尝试。

标签: linux lsof


【解决方案1】:

使用 awk:

lsof  | awk '{print $1,$2}'

这将只打印第 1 列和第 2 列

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-08-22
    • 2014-03-27
    • 1970-01-01
    相关资源
    最近更新 更多