1 取出当前已登陆的用户名
2 取出最后登录用户的相关信息
3 取出默认shell最多的的类型
4 转移
[redsun@jiange root]$ sort -t: -k3 -n -r /etc/passwd | sed -n "1,+3p" | tr 'a-z' 'A-Z' > /tmp/maxusers.txt
[redsun@jiange root]$ echo /tmp/maxusers.txt
/tmp/maxusers.txt
[redsun@jiange root]$ less /tmp/maxusers.txt
[redsun@jiange root]$ more /tmp/maxusers.txt
REDSUN:X:1000:1000::/HOME/REDSUN:/BIN/BASH
SYSTEMD-BUS-PROXY:X:999:997:SYSTEMD BUS PROXY:/:/SBIN/NOLOGIN
SYSTEMD-NETWORK:X:998:996:SYSTEMD NETWORK MANAGEMENT:/:/SBIN/NOLOGIN
POLKITD:X:997:995:USER FOR POLKITD:/:/SBIN/NOLOGIN
5: 获取主机ip
[redsun@jiange root]$ ifconfig | grep inet | sed -n '1, +0p' | awk '{print $2}'
[redsun@jiange root]$ ifconfig | grep inet | sed -n '1, +0p'
inet 192.168.149.128 netmask 255.255.255.0 broadcast 192.168.149.255
[redsun@jiange root]$ ifconfig | grep inet | sed -n '1, +0p' | awk '{print $2}'
192.168.149.128
原创文章,作者:N24_xingxiu,如若转载,请注明出处:http://www.178linux.com/59139