LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Cannot delete a recently created directory in Lubuntu, or files in that directory (https://www.linuxquestions.org/questions/linux-newbie-8/cannot-delete-a-recently-created-directory-in-lubuntu-or-files-in-that-directory-4175507202/)

l33y 06-05-2014 09:27 PM

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?

Emerson 06-05-2014 09:58 PM

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.

k3lt01 06-05-2014 10:26 PM

Quote:

Originally Posted by Emerson (Post 5183324)
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

jamison20000e 06-05-2014 10:41 PM

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?

rokytnji 06-05-2014 10:54 PM

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

k3lt01 06-05-2014 11:17 PM

Quote:

Originally Posted by rokytnji (Post 5183344)
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.

rokytnji 06-06-2014 12:02 AM

Quote:

Originally Posted by k3lt01 (Post 5183351)
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.

l33y 06-06-2014 06:32 PM

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

Emerson 06-06-2014 06:49 PM

Quote:

Originally Posted by k3lt01 (Post 5183332)
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).

jamison20000e 06-06-2014 07:11 PM

I've never looked into it that much:
Code:

man rm
I guessed the -f was for folder, lol.

k3lt01 06-06-2014 07:39 PM

Quote:

Originally Posted by Emerson (Post 5183819)
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.

Emerson 06-06-2014 07:42 PM

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.

jamison20000e 06-06-2014 07:50 PM

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

Emerson 06-06-2014 08:07 PM

Too many beers?

jpollard 06-06-2014 08:15 PM

Quote:

Originally Posted by l33y (Post 5183813)
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.


All times are GMT -5. The time now is 07:37 AM.