如何能显示字段名??

[复制链接]
查看11 | 回复2 | 2005-10-30 17:05:33 | 显示全部楼层 |阅读模式
在UNIX中,怎样才能在使用ls,ps -ef|grep sh等命令时显示出字段名??
ps(有)
PID TTY TIME COMMAND
24245 pts/tm0:00 sh
25495 pts/tm0:00 ps
24244 pts/tm0:00 telnetd

ps -ed|grep sh(无)
25153 pts/tY0:00 sh
14902 pts/ti0:00 sh
12882 pts/td0:00 sh
24477 pts/tN0:00 sh



回复

使用道具 举报

千问 | 2005-10-30 17:05:33 | 显示全部楼层
{
ps -ed|grep PID>~/temp.log
ps -ed|grep sh>>~/temp.log
cat ~/temp.log
rm ~/temp.log
}
回复

使用道具 举报

千问 | 2005-10-30 17:05:33 | 显示全部楼层
ps -ed|awk '{if($1=="PID&quot

{print} else {if($4=="sh&quot

{print}}}'
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行