userdel命令:删除用户账号
Usage: userdel [options] LOGIN
Options:
-f, --force 强力删除
-r, --remove 移除主目录等文件..
1、删除用户cdy
userdel cdy
他只删除账号信息。
2、删除用户并移出home目录等
userdel -r cdy
如果用户登录了则删除不了,但可以用 -f强力删除。
例子
[root@freeswitch ~]# useradd huangbiao [root@freeswitch ~]# cd /home/ [root@freeswitch home]# ls 123 123456 huangbiao [root@freeswitch home]# cd huangbiao/ [root@freeswitch huangbiao]# ls [root@freeswitch huangbiao]# cd / [root@freeswitch /]# userdel -r huangbiao [root@freeswitch /]# cd /home/ [root@freeswitch home]# ls 123 12345