rm usage question
Hello,
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? |
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? |
Quote:
|
There's just two commands:
userdel -f <username> Next is to cd to /export/home and type: rm -fr username.date so the output looks like rm -fr username.080516 |
Quote:
|
Quote:
Code:
rm -fr username 080516 You can test using: Code:
echo rm -fr username 080516 Just a thought... |
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. Just a thought. |
All times are GMT -5. The time now is 04:10 PM. |