Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I just recently started using CentOS 6.4. I've been tasked with deleting an account from the system. The command given to do this is:
userdel -f <username>
Next is to cd to /export/home and type:
rm -fr username.date so the output looks like rm -fr user.080516
I see the username in the /export/home as a directory. I'm trying to understand what this command with the username.date is doing. I executed the command but the users home directory still shows in /export/home.
"rm -fr" is a dangerous command. It means "delete this directory and every file and directory it contains without prompting for confirmation". Run as root, it will delete anything you tell it, including the operating system itself. Typos, accidental wildcards, or simply being in the wrong directory when you run it can result in a lot of damage. Used properly of course there's no problem, it's just "risky".
When you ran the command, did you get any error messages? An error should be the only thing that keeps it from completely removing the directory and its contents, which you said it didn't do. Either that or you typed the directory name incorrectly, did you use tab completion or copy-paste, or did you just type the name in by hand and hope for the best?
Last edited by suicidaleggroll; 08-05-2016 at 09:59 AM.
Thanks for the reply. I didn't get an error running the command. What I didn't quite understand is the instructions say to enter the username followed by the date.
example: username.080516
In /export/home the directories are only listed with the username and no date. So, if I run the command using the username.date format I'm not sure what it's removing since all the directories are just the username. In order to remove the directory and contents wouldn't I just enter the command followed by username only?
Thanks for the reply. I didn't get an error running the command. What I didn't quite understand is the instructions say to enter the username followed by the date.
example: username.080516
In /export/home the directories are only listed with the username and no date. So, if I run the command using the username.date format I'm not sure what it's removing since all the directories are just the username. In order to remove the directory and contents wouldn't I just enter the command followed by username only?
Could you possibly cut and paste the instructions here?
Thanks for the reply. I didn't get an error running the command. What I didn't quite understand is the instructions say to enter the username followed by the date.
example: username.080516
In /export/home the directories are only listed with the username and no date. So, if I run the command using the username.date format I'm not sure what it's removing since all the directories are just the username. In order to remove the directory and contents wouldn't I just enter the command followed by username only?
You are correct. Running "rm -fr username.080516" when there is no directory called "username.080516" will not do anything, it will just silently exit. "rm -fr" will only do anything if the argument you give it is a real file/directory, in which case it will remove it.
I'm trying to understand what this command with the username.date is doing. I executed the command but the users home directory still shows in /export/home.
Is there a possibility that your implementation of userdel includes the configuration variable USERDEL_CMD in /etc/login.defs which automatically populates /export/home with the new folder username.date?
In this case, you would have to run the userdel command to create the username.date directory.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.