centos中的用户和用户组

用户列表文件:/etc/passwd
用户组列表文件:/etc/group

 

查看系统中有哪些用户:cut -d : -f 1 /etc/passwd    

cut:显示所选择的相关段。(-f 1 指的是一列,-d 指出分割符是冒号,PS:冒号和d之间有空格)
查看可以登录系统的用户:cat /etc/passwd | grep -v /sbin/nologin | cut -d : -f 1

使用grep -v时候,想去除多个pattern

grep -v with multiple patterns
grep test somefile | grep -v -e error -e critical -e warning
grep test somefile | grep -vE '(error|critical|warning)'
grep -vE 'root|adm' /etc/passwd

 

查看用户操作:w命令(需要root权限)

查看某一用户:w 用户名

查看登录用户:who

查看用户登录历史记录:last

posted @ 2019-06-19 15:26  ToDarcy  阅读(304)  评论(0)    收藏  举报