免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3543 | 回复: 5
打印 上一主题 下一主题

[SCO UNIX] 7.1.1,who -x没有IP显示。 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2010-05-25 12:01 |只看该作者 |倒序浏览
看到很多脚本里用
IP=`who -mx|awk -F ' ' '{print $6}'|cut -f1-4 -d'.'`
的语句取IP,跑了一次,没成功。发现自己的sco unix中使用who -x命令没有IP显示...

求助...

论坛徽章:
0
2 [报告]
发表于 2010-05-25 12:45 |只看该作者
# who
root       console      May 25 09:07
root       pts001       May 25 10:23
root       pts002       May 25 10:25
root       pts003       May 25 10:28
root       pts004       May 25 10:57
# who -m
root       pts004       May 25 10:57
# who -x
root       console      May 25 09:07
root       pts001       May 25 10:23
root       pts002       May 25 10:25
root       pts003       May 25 10:28
root       pts004       May 25 10:57
#

论坛徽章:
0
3 [报告]
发表于 2010-05-25 12:53 |只看该作者
每个unix系统的命令细节上有差别的
自己man who看看帮助

论坛徽章:
0
4 [报告]
发表于 2010-05-25 13:01 |只看该作者
UX:who: TO FIX: Usage:  who [-abdHlLmnpqrstTux] [am i] [utmp_like_file|utmpx_like_file]
a       all (Abdlprtu options)
b       boot time
d       dead processes
H       print header
l       login processes
L       port monitors
m       information about the current terminal
n #     specify number of users per line for -q
p       processes other than getty or users
q       quick who
r       run level
s       short form of who (no time since last output or pid)
t       time changes
T       status of tty (+ writable, - not writable, ? hung)
u       useful information
x       use utmpx format

所有参数均不限时IP...

有其他办法在profile阶段取得终端IP的吗?

论坛徽章:
0
5 [报告]
发表于 2010-05-27 12:05 |只看该作者
本帖最后由 dooza 于 2010-05-27 12:12 编辑

有2个办法可以显示:
1、netstat -an | grep 服务器ip.23 | grep ESTABLISHED

2、last | grep still

论坛徽章:
0
6 [报告]
发表于 2010-05-27 17:37 |只看该作者
我估计楼主是想在登录时查看当前登录用户的ip。如果是这样的话,有一个解决办法
第一步,使用finger命令查看当前所有登录用户的信息。这些信息里包括了登录用户的tty号和ip信息(控制台除外)
第二步,使用tty命令显示当前登录用户的tty号。
但是,两个命令显示的tty号的格式是不一样的,需要进行处理。

接下去的工作楼主应该自己会做了吧?
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP