[root@zabbix ~]# cut -d ":" -f 1,3 /etc/passwd root:0 bin:1 daemon:2 adm:3 lp:4 sync:5 shutdown:6 halt:7 mail:8 operator:11 games:12 ftp:14 nobody:99 systemd-network:192 dbus:81 polkitd:999 sshd:74 postfix:89 chrony:998 apache:48 zabbix:997 mysql:27 利用cut编写批量删除用户的脚本 #!/bin/bash for user in `cat /etc/passwd | grep /bin/bash | grep -v root | cut -d ":" -f 1` do #echo $user userdel $user done