LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 08-05-2016, 10:26 AM   #1
GooberJack
LQ Newbie
 
Registered: Aug 2016
Distribution: CentOS 6.4
Posts: 4

Rep: Reputation: Disabled
Question 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.
 
Old 08-05-2016, 10:57 AM   #2
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,258

Rep: Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947
"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 10:59 AM.
 
Old 08-05-2016, 11:12 AM   #3
GooberJack
LQ Newbie
 
Registered: Aug 2016
Distribution: CentOS 6.4
Posts: 4

Original Poster
Rep: Reputation: Disabled
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?
 
Old 08-05-2016, 11:18 AM   #4
hydrurga
Senior Member
 
Registered: Nov 2008
Distribution: Linux Mint 18 MATE
Posts: 1,209

Rep: Reputation: 341Reputation: 341Reputation: 341Reputation: 341
Quote:
Originally Posted by GooberJack View Post
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?
 
Old 08-05-2016, 11:27 AM   #5
GooberJack
LQ Newbie
 
Registered: Aug 2016
Distribution: CentOS 6.4
Posts: 4

Original Poster
Rep: Reputation: Disabled
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
 
Old 08-05-2016, 11:30 AM   #6
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,258

Rep: Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947
Quote:
Originally Posted by GooberJack View Post
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.
 
Old 08-05-2016, 11:30 AM   #7
Habitual
LQ Addict
 
Registered: Jan 2011
Location: Youngstown, Ohio
Distribution: LM17.1/Xfce4.11.8
Posts: 7,159
Blog Entries: 10

Rep: Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968
Quote:
Originally Posted by GooberJack View Post
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.
I would expect ...
Code:
rm -fr username 080516
for bash history?

You can test using:
Code:
echo rm -fr username 080516
to see it as a "dry run".

Just a thought...
 
Old 08-05-2016, 11:42 AM   #8
hydrurga
Senior Member
 
Registered: Nov 2008
Distribution: Linux Mint 18 MATE
Posts: 1,209

Rep: Reputation: 341Reputation: 341Reputation: 341Reputation: 341
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Disk usage question joboy Debian 11 01-18-2016 12:13 AM
Memory usage question gymnart Linux - Hardware 4 10-26-2009 12:38 PM
Cpu usage question mokku Linux - Server 6 09-02-2008 09:33 AM
how to determine cpu usage, memory usage, I/O usage by a particular user logged on li rags2k Programming 4 08-21-2004 05:45 AM
Memory usage question oneandoneis2 Linux - General 2 06-27-2004 01:29 PM


All times are GMT -5. The time now is 08:11 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration