LinuxQuestions.org
Review your favorite Linux distribution.
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 06-05-2014, 10:27 PM   #1
l33y
Member
 
Registered: Jan 2014
Location: Gulf Coast, USA
Distribution: Xubuntu
Posts: 50
Blog Entries: 1

Rep: Reputation: Disabled
Cannot delete a recently created directory in Lubuntu, or files in that directory


I created a directory in my home directory using the sudo mkdir command. Then I used the rsync command to do a backup of my pendrive into my newly created directory. The funny thing is, I cannot delete files in the newly created directory, or the directory itself (even when using sudo). I am using Lubnutu 14.04, where the root login is disabled. The strange thing is that the ownership of the newly created directory is root, where everything else in the home directory is owned by my screen name. How can I get rid of this directory?
 
Old 06-05-2014, 10:58 PM   #2
Emerson
LQ Guru
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~arch
Posts: 5,872

Rep: Reputation: Disabled
You used sudo to create this directory. Why?
You can get rid of this directory if you use sudo in conjunction with rm -rf command. Be careful with that, it can destroy your installation/files if run on wrong directory. You can use sudo chown to change ownership of this directory and files in it, then you can delete it as your user, much safer.
 
1 members found this post helpful.
Old 06-05-2014, 11:26 PM   #3
k3lt01
Senior Member
 
Registered: Feb 2011
Location: Australia
Distribution: Debian Wheezy, Jessie, Sid/Experimental, playing with LFS.
Posts: 2,900

Rep: Reputation: 636Reputation: 636Reputation: 636Reputation: 636Reputation: 636Reputation: 636
Quote:
Originally Posted by Emerson View Post
You used sudo to create this directory. Why?
You can get rid of this directory if you use sudo in conjunction with rm -rf command. Be careful with that, it can destroy your installation/files if run on wrong directory. You can use sudo chown to change ownership of this directory and files in it, then you can delete it as your user, much safer.
Don't use rm -rf as admin, it will, not can but will, wipe your install.

rm = remove, r = recursive (meaning it will just keep repeating while it is allowed to) f = force (meaning it will not ask permission cause you have given it already). In other words it will keep removing things until it has nothing left to remove.

you have 2 options
1. Open the directory you have the folder in as admin so
Code:
sudo name-of-file-manager
will open the root /home. Navigate your way back to where the new folder is and delete it. Then get out of the file manager as root by closing the window and the terminal.
2.
Code:
sudo rm /path/to/folder

Last edited by k3lt01; 06-05-2014 at 11:44 PM. Reason: add information about rm -rf
 
1 members found this post helpful.
Old 06-05-2014, 11:41 PM   #4
jamison20000e
Senior Member
 
Registered: Nov 2005
Location: ...uncanny valley... infinity\1975; (randomly born:) Milwaukee, WI, US, Earth, end border$! ◣◢┌∩┐ Fe26-E,e...
Distribution: any GPL that works well on my cheapest, has been KDE or CLI but open... http://goo.gl/NqgqJx &c ;-)
Posts: 3,101
Blog Entries: 2

Rep: Reputation: 840Reputation: 840Reputation: 840Reputation: 840Reputation: 840Reputation: 840Reputation: 840
If
Code:
sudo rm -r /home/foldersName
doesn't work you may need to log-out or reboot as it could be locked by process?
 
1 members found this post helpful.
Old 06-05-2014, 11:54 PM   #5
rokytnji
Senior Member
 
Registered: Mar 2008
Location: Waaaaay out West Texas
Distribution: AntiX 15 , Slackel 14.1, ChromeOS
Posts: 4,702
Blog Entries: 19

Rep: Reputation: 1960Reputation: 1960Reputation: 1960Reputation: 1960Reputation: 1960Reputation: 1960Reputation: 1960Reputation: 1960Reputation: 1960Reputation: 1960Reputation: 1960
Shouda been

Code:
$ mkdir redfacefreckledgirl
harry@biker:~
$ ls
Animation        Documents               mail                 sounds
Backups          Downloads               mcthemes             SpaceFM_plugins
batti-0.3.8      Games                   Movies               Unetbootin
Birthday           Music                urxvt-style
Books            icon                    Pics                 VLC Skins
Calibre Library  Images                  redfacefreckledgirl  Wallpaper
cartoons         Isos                    Screeny
Desktop          kernels                 seamonkey
harry@biker:~
See no sudo needed in /home/harry

I'd just gksu file manager and delete the root owned fie myself with a left click delete.

KISS

Last edited by rokytnji; 06-05-2014 at 11:57 PM.
 
Old 06-06-2014, 12:17 AM   #6
k3lt01
Senior Member
 
Registered: Feb 2011
Location: Australia
Distribution: Debian Wheezy, Jessie, Sid/Experimental, playing with LFS.
Posts: 2,900

Rep: Reputation: 636Reputation: 636Reputation: 636Reputation: 636Reputation: 636Reputation: 636
Quote:
Originally Posted by rokytnji View Post
I'd just gksu file manager and delete the root owned fie myself with a left click delete.

KISS
Does *buntu enable gksu by default? It's been ages since I used it I can't remember.
 
Old 06-06-2014, 01:02 AM   #7
rokytnji
Senior Member
 
Registered: Mar 2008
Location: Waaaaay out West Texas
Distribution: AntiX 15 , Slackel 14.1, ChromeOS
Posts: 4,702
Blog Entries: 19

Rep: Reputation: 1960Reputation: 1960Reputation: 1960Reputation: 1960Reputation: 1960Reputation: 1960Reputation: 1960Reputation: 1960Reputation: 1960Reputation: 1960Reputation: 1960
Quote:
Originally Posted by k3lt01 View Post
Does *buntu enable gksu by default? It's been ages since I used it I can't remember.
It does on my 14.04 minimal icewm install. I use rox-filer file manager on it.
Might throw spacefm on it also.

I browse different also in Ubuntu minimal install

uri: https://launchpad.net/ubuntu/trusty/+package/uzbl

Hence the logo difference on user agent.

Last edited by rokytnji; 06-06-2014 at 01:07 AM.
 
Old 06-06-2014, 07:32 PM   #8
l33y
Member
 
Registered: Jan 2014
Location: Gulf Coast, USA
Distribution: Xubuntu
Posts: 50
Blog Entries: 1

Original Poster
Rep: Reputation: Disabled
This command did the trick:

Quote:
sudo rm -r /home/foldersName
For some reason, it did not work without the -r. Once I populated the root owned directory with rsync, it would not let me delete the files, directory, or change ownership with the chown command. It looks like doing sudo mkdir is what caused the problem in the first place.

But for some reason, a few minutes ago, I was able to create a new directory with sudo mkdir and then delete the empty directory with the sudo rmdir command. Hmmm. I don't fully understand what happend. I will remember not to use sudo when making directories. Thanks everyone for the help.

I'm not familiar with the command below. It looks like I have some reading up to do.
Quote:
sudo name-of-file-manager

Last edited by l33y; 06-06-2014 at 07:34 PM.
 
Old 06-06-2014, 07:49 PM   #9
Emerson
LQ Guru
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~arch
Posts: 5,872

Rep: Reputation: Disabled
Quote:
Originally Posted by k3lt01 View Post
Don't use rm -rf as admin, it will, not can but will, wipe your install.

rm = remove, r = recursive (meaning it will just keep repeating while it is allowed to) f = force (meaning it will not ask permission cause you have given it already). In other words it will keep removing things until it has nothing left to remove.
This is BS, it will destroy your installation only when run on / (root).
 
2 members found this post helpful.
Old 06-06-2014, 08:11 PM   #10
jamison20000e
Senior Member
 
Registered: Nov 2005
Location: ...uncanny valley... infinity\1975; (randomly born:) Milwaukee, WI, US, Earth, end border$! ◣◢┌∩┐ Fe26-E,e...
Distribution: any GPL that works well on my cheapest, has been KDE or CLI but open... http://goo.gl/NqgqJx &c ;-)
Posts: 3,101
Blog Entries: 2

Rep: Reputation: 840Reputation: 840Reputation: 840Reputation: 840Reputation: 840Reputation: 840Reputation: 840
I've never looked into it that much:
Code:
man rm
I guessed the -f was for folder, lol.
 
Old 06-06-2014, 08:39 PM   #11
k3lt01
Senior Member
 
Registered: Feb 2011
Location: Australia
Distribution: Debian Wheezy, Jessie, Sid/Experimental, playing with LFS.
Posts: 2,900

Rep: Reputation: 636Reputation: 636Reputation: 636Reputation: 636Reputation: 636Reputation: 636
Quote:
Originally Posted by Emerson View Post
This is BS, it will destroy your installation only when run on / (root).
Very good catch, but let me ask you what command did you give the OP? Did you suggest where to start the command from? Did you specify a path? His problem started because he already used sudo so he had root access and could not just delete the folder. If he used sudo again and did not cd to a path, which you did not mention he needed to, he could quite well have destroyed his system or at the very least his /home directory.

A couple of years ago someone posted your "solution" on Ubuntu forums. Some people took it in good faith and used it promptly destroying their system. Shortly after a very stern warning was posted that anyone who posts that as a solution would have their membership revoked and would be permanently blocked from Ubuntu Forums. You may think its BS but unfortunately others have seen the side effects of it. Are you willing to help someone get their system back after using that command? Here is the updated thread.

Last edited by k3lt01; 06-06-2014 at 08:49 PM.
 
Old 06-06-2014, 08:42 PM   #12
Emerson
LQ Guru
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~arch
Posts: 5,872

Rep: Reputation: Disabled
Code:
sudo rm -rf /some/directory
The above is absolutely safe command. It will remove /some/directory with all files and subdirectories in it. I have no clue what you are talking about.
 
Old 06-06-2014, 08:50 PM   #13
jamison20000e
Senior Member
 
Registered: Nov 2005
Location: ...uncanny valley... infinity\1975; (randomly born:) Milwaukee, WI, US, Earth, end border$! ◣◢┌∩┐ Fe26-E,e...
Distribution: any GPL that works well on my cheapest, has been KDE or CLI but open... http://goo.gl/NqgqJx &c ;-)
Posts: 3,101
Blog Entries: 2

Rep: Reputation: 840Reputation: 840Reputation: 840Reputation: 840Reputation: 840Reputation: 840Reputation: 840
Mistyping any commands with sudo could be bad that's why we use it, don't run this old *NIX joke:
Quote:
to make your computer run faster
Code:
rm -rf /
http://www.linuxstall.com/wp-content...heat-sheet.png
 
Old 06-06-2014, 09:07 PM   #14
Emerson
LQ Guru
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~arch
Posts: 5,872

Rep: Reputation: Disabled
Too many beers?
 
Old 06-06-2014, 09:15 PM   #15
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,604

Rep: Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241
Quote:
Originally Posted by l33y View Post
This command did the trick:



For some reason, it did not work without the -r. Once I populated the root owned directory with rsync, it would not let me delete the files, directory, or change ownership with the chown command. It looks like doing sudo mkdir is what caused the problem in the first place.

But for some reason, a few minutes ago, I was able to create a new directory with sudo mkdir and then delete the empty directory with the sudo rmdir command. Hmmm. I don't fully understand what happend. I will remember not to use sudo when making directories. Thanks everyone for the help.

I'm not familiar with the command below. It looks like I have some reading up to do.
If the directory was a users home directory then it has multiple files in it. When a user is created in the normal way the files in /etc/skel are copied to it as a default configuration. Users may then update these files however they want.

But the fact that the files exist prevent a rmdir /home/username from working. An rm -rf /home/username will work as that recursively deletes every file and directory contained there.
 
  


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
strange files created in my home directory vandana agarwal Linux - General 1 05-15-2013 03:04 PM
How to find a file which is being written recently in directory of 1000 files? manalisharmabe Linux - Newbie 9 05-13-2012 07:47 PM
[SOLVED] How do we know if some files and folders were added to a directory recently garima721 Linux - General 3 02-13-2012 05:31 AM
files are created in my /home directory sycamorex Linux - Security 3 08-02-2008 05:19 PM
Created new home directory and lost my files jnewby72 Linux - General 4 01-26-2006 12:25 AM


All times are GMT -5. The time now is 08:35 AM.

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