more /etc/passwd 查看用户

 

cat /etc/passwd |cut -f1 -d:

查看系统有哪些用户,在这里冒号可以用单引号括起来也可以不用,冒号与-d之间可以有空格也可以没有空格,-f后面是数字1

 

cat使用方法拓展:

cat除了可以像DOS中的type显示文本文件的内容外还可以起到拼接作用

例如:

同时显示/etc/passwd/etc/group两个文件中的内容:

cat /etc/passwd /etc/group

想把以上两个文件并到一个文件中时用以下方法:

cat /etc/passwd /etc/group >/tmp/complete

 

Cut使用方法拓展:

cut -d'分隔字符' -f fields

cut -c 字符区间

 

参数:

-d 后面接分隔字符。与-f一起使用

-f 依据-d的分隔字符将一段信息分割为数段,用-f取出第几段的意思;

-c 以字符(characters)的单位取出固定字符区间;

 

w 查看当前登录用户;finger可以查询到其它使用者的情况

last
使用权限:所有使用者
使用方式:
shell>> last [options]
说明:显示系统开机以来获是从每月初登入者的讯息

把计
G

-R
省略 hostname 的栏位

-num
展示前 num

username
展示 username 的登入讯息

tty
限制登入讯息包含终端机代号


范例:


shell>> last -R -2
johnney pts/1 Mon Aug 14 20:42 still logged in
johnney pts/0 Mon Aug 14 19:59 still logged in
wtmp begins Tue Aug 1 09:01:10 2000 ### /var/log/wtmp

shell>> last -2 minery
minery pts/0 140.119.217.115 Mon Aug 14 18:37 - 18:40 (00:03)
minery pts/0 140.119.217.115 Mon Aug 14 17:22 - 17:24 (00:02)
wtmp begins Tue Aug 1 09:01:10 2000