1 创建一个用户名
bintian.xbt@localhost:~$ sudo useradd -m bintian.test
[sudo] password for bintian.xbt:
bintian.xbt@localhost:~$ cd /home/bintian.test/
bintian.xbt@localhost:/home/bintian.test$ ls
examples.desktop
bintian.xbt@localhost:/home/bintian.test$ ls -al
drwxr-xr-x 2 bintian.test bintian.test 4096 Dec 29 21:28 .`这里写代码片`
drwxr-xr-x 80 root root 4096 Dec 29 21:28 ..
-rw-r--r-- 1 bintian.test bintian.test 220 Apr 3 2012 .bash_logout
-rw-r--r-- 1 bintian.test bintian.test 3486 Apr 3 2012 .bashrc
-rw-r--r-- 1 bintian.test bintian.test 8445 Apr 17 2012 examples.desktop
-rw-r--r-- 1 bintian.test bintian.test 675 Apr 3 2012 .profile
2删除用户名
bintian.xbt@localhost:~$ sudo userdel -r bintian.test
[sudo] password for bintian.xbt:
userdel: user bintian.test is currently logged in
查找资料发现:主要是新建的用户还有一些进程在运行 通过 lsof | grep bintian.test or lsof -u bintian.test 命令可以查看
解决办法:pkill -u username or pkill -u uid 杀掉与bintian.test有关的进程就可以了