Questions tagged [rm]

Questions relating to the Linux remove command (rm)

284 questions
50
votes
7 answers

Is there any faster way to remove a directory than "rm -rf"?

I have a folder that has many files and "rm -rf" takes a lot of time to complete. Is there any faster way to remove a directory and it's contents (subdirs, etc)?
46
votes
7 answers

"No such file or directory" when trying to remove a file, but the file exists?

I am trying to remove a png image that was uploaded to my server via a PHP script. Whenever I try to delete it both through ftp and terminal, I get the error No such file or directory However, when I ls in the dir, the file is listed and it is…
16
votes
4 answers

How can I make rm stop asking me for permission?

On my server rm always asks me for permission (even though I'm root) when I run it, on my desktop it does not. Like so: $ rm mod_wsgi-3.3.tar.gz rm: remove regular file `mod_wsgi-3.3.tar.gz'? How do I make it stop prompting me?
Kit Sunde
  • 11,096
7
votes
1 answer

"rm" command defaults "--preserve-root" option?

They say rm command defaults to the option --preserve-root. Is that right? Otherwise I should put the line alias rm='rm --preserve-root'` in ~/.bashrc to make that option happen without typing it every time I run the rm command. To confirm this I…
Smile
  • 1,099
5
votes
2 answers

how would i use rm to delete all files without certain wildcard?

using rm *text* you can delete all files which have a certain string in them. How would I make it so that it removes every file except for the ones with the specific wildcard? I have attempted to use other things I've found, such as: find . -type f…
chaps
  • 53
2
votes
2 answers

How to delete /dev folder that is accidentaly copied to external hdd?

I have accidentally copied the entire contents of root to my external hard drive because of using wrong syntax of cp. I have deleted the rest leaving /dev folder. Using rm results to "device busy" and already have opened it on windows to delete but…
1
vote
2 answers

Started to delete /usr/share by mistake: what to do now?

In Ubuntu 16.04, I ran by mistake sudo rm -rf /usr/share. I know how stupid that is (I wanted to remove /usr/share/somefolder that had been installed as root and got distracted). I interrupted it after about 5 seconds. I can already see some strange…
1
vote
2 answers

Is it safe to run rm -r "$HOME/.wine"?

I looked on google for how to uninstall Wine. I found something and it told me to enter these: rm -r "$HOME/.wine" rm $HOME/.config/menus/applications-merged/wine* rm -r "$HOME/.local/share/applications/wine" rm…
RedStar12
  • 103
1
vote
0 answers

Is there any way to undo operation of last command in ubuntu?

The files located in extension directory got deleted through execution of rm command in terminal Please suggest me appropriate solution to undo operation of last rm command
Rubin Porwal
  • 121
  • 2
0
votes
1 answer

Remove some files but not all

I have a directory with some files, especially .tex files and those created by pdflatex. I want to be able to give a name name and remove all the files called name except name.tex I tried rm name.* !(name.tex) but it has removed every file in the…
Ccile
  • 103
0
votes
3 answers

How to remove a file from usr/share/applications on ubuntu 14.04

I have examined this page (How to remove single file from /usr directory?) and tried sudo rm /usr/share/applications/Eclipse Mars C/C++.desktop in the terminal, but it didn't work. I think the reason is that I use a different version (mine is…
NoWeDoR
  • 35
0
votes
2 answers

I just want to remove the file from directory

I am trying to remove a file with: ubuntu64@ubuntu:/usr/local/mongodb$ rm /usr/local/mongodb/* But every time it just outputs: rm: cannot remove ‘/usr/local/mongodb/mongodb-linix-x86_64-2.6.4’: Permission denied Why am I getting this error and how…
0
votes
1 answer

How do I determine what is using the folder?

I just can't delete the folder under root (it says that resource/device is busy), but lsof and fuser tell me nothing. The folder is located in the depth of /var/www/... and I tried to delete it after I stop apache2 and nginx.
Airee
  • 25
0
votes
1 answer

rm: cannot remove *: Is a Directory

I installed "darling" and now want to delete it, but this shows up: rm: cannot remove 'darling': Is a directory When I ran rmdir it says: rmdir: failed to remove 'darling/': Directory not empty Even ran sudo umount darling, still no luck.
0
votes
1 answer

Entire system starts malfunctioning after empyting bin

So recently I wiped the trash bin folder with the sudo rm /bin command because it was getting filled up with a lot of junk that I didn't put there. Now I can't boot and get error messages. I don't get how empyting the bin can break the system... Did…
1
2