I used the following command rm -rf inttergat to remove the directory. But I get stuck with following errors:  rpa-vd1-296: rm -rf inttegrat/ rm: cannot remove ‘inttegrat/.nfs0000000005d154320000000b’: Device or resource busy
61231
I removed a file and now I see:  $ ls total 64 -rw-rw-r-- 1 502 17229 Sep 17 16:42 page_object_methods.rb drwxrwxr-x 7 502   238 Sep 18 18:41 ../ -rw-rw-r-- 1 502 18437 Sep 18 18:41 new_page_object_methods.rb -rw-r--r-- 1 502 16384 Sep 18 18:42 .nfs0000000000b869e300000001 drwxrwxr-x 5 502   170 Sep 21 13:48 ./ 13:48:11 *vagrant* ubuntu-14 selenium_rspec_conversion   and if I try to remove it:  $ rm .nfs0000000000b869e300000001 rm: cannot remove ‘.nfs0000000000b869e300000001’: Device or resource busy   What does this indicate?  What should I do
21282
I have a folder containing a lot of folders and different files with the following structures :  NASA │ ├── a │   ├── doc1 │   ├── doc2 │   ├── doc3 │   ├── folder1 │   └── folder2 │ ├── b │   ├── doc1 │   ├── doc2 │   ├── doc3 │   ├── folder1 │   └── folder2 │ ├── c │   ├── doc1 │   ├── doc2 │   ├── doc3 │   ├── folder1 │   └── folder2 │ ├─ x ├─ y └─ z          I want to delete the content of the folder (NASA/) except specified folders and files.   For example I want to keep a folder, b folder and x file.     I tried   :   rm !(a/) -r NASA/   And (as explained in the answer ):  find NASA/ -type f ! -iname "x" -delete   But this is not very straight forward and I have to use a bash script.    Am I missing a more easy way ? How can I do this in a single command?
14124
I need to delete one folder containing other folders and files inside. I tried del and rmdir commands but sometimes they fail with some error lines: [PATH]: The directory isn't empty.  Is there any good alternative?
63029
I have a folder with 137795 files in it.  I need to delete all of them.  When I run rm * I get -bash: /bin/rm: Argument list too long.  How do I get past this error?
969
Sometimes when I'm working in Windows I'll get this prompt when I try to delete a directory:    Folder In Use The action can't be completed because the folder is open in another program Close the folder and try again.   However, the folder isn't "in use" at all, and I don't have it open. So how can I delete it short of rebooting?
38015
I have a folder on my desktop which is named ".." (which itself contains subfolders with an empty name). The folder can't be deleted the usual ways, even not when using the CLI. Does anyone know how I can remove this folder on Windows Vista 64-bit?  Renaming does not work, either (obviously).  This is what "dir /x" echoes:  09.10.2009  15:04    &lt;DIR&gt;                       . 09.10.2009  15:04    &lt;DIR&gt;                       .. 08.03.2007  11:18    &lt;DIR&gt;                       cgi-bin                0 Datei(en),              0 Bytes                3 Verzeichnis(se), 45.866.037.248 Bytes frei
79070
Through a boneheaded maneuver on my part, I accidentally created a directory called (for instance) -A, and ended up filling it with files.  I want to delete said directory. I've tried:  rmdir -- -A   but it then tells me that the directory still has files in it. And I can't figure out how to cd into the directory to delete said files.  What should I do to get rid of this troublesome directory?
103411
Some time ago I erroneously deleted my home folder because I ran a rm -rf * on the wrong terminal, whose working directory was the home folder!  I wish I had an alias for the rm command, but it was not the case.  Now, I am planning to make a script as an alias for rm.  Do you have any best practice to suggest?  Thanks.
39006
By accident, I used rm on a file I didn't want to delete. Is there a way that I can get it back under Linux?
83812
I stupidly ran sudo rm /* followed by sudo rm -R /*  My sites still run, although the vast majority of commands like ls are now broken.  Is there a simple way to get data off the server or reverse some of damage?
22815
I have a folder in which I have around 4k files. Some of these files start with a a ? or ! character. I need to delete them but can't find an expression that would do so:   rm -f ./?*   just deletes everything. I can possibly use grep on ls and pipe it through xargs and move files to another folder but I was hoping there was a proper way of doing this. Need help on both the ? and ! files.
89026
I am running out of disk space and noted that I have a large /var/cache directory. Can I safely remove this? (using Arch Linux, BTW).
71104
Possible Duplicate:          Hi,  Is there any simple way to undo an rm command?  The question is purely theoretical; I have NEVER deleted the log of a benchmark queue who took a whole lunchtime to run.
62014
I want to list and remove the content of a directory on a removable hard drive. But I have experienced "Input/output error":  $ rm  pic -R rm: cannot remove `pic/60.jpg': Input/output error rm: cannot remove `pic/006.jpg': Input/output error rm: cannot remove `pic/008.jpg': Input/output error rm: cannot remove `pic/011.jpg': Input/output error  $ ls -la pic ls: cannot access pic/60.jpg: Input/output error -????????? ? ?    ?         ?            ? 006.jpg -????????? ? ?    ?         ?            ? 006.jpg -????????? ? ?    ?         ?            ? 011.jpg   I was wondering what the problem is?  How can I recover or remove the directory pic and all of its content?  My OS is Ubuntu 12.04, and the removable hard drive has ntfs filesystem. Other directories not containing or inside pic on the removable hard drive are working fine.    Added:   Last part of output of dmesg after I tried to list the content of the directory:  [19000.712070] usb 1-1: new high-speed USB device number 2 using ehci_hcd [19000.853167] usb-storage 1-1:1.0: Quirks match for vid 05e3 pid 0702: 520 [19000.853195] scsi5 : usb-storage 1-1:1.0 [19001.856687] scsi 5:0:0:0: Direct-Access     ST316002 1A               0811 PQ: 0 ANSI: 0 [19001.858821] sd 5:0:0:0: Attached scsi generic sg2 type 0 [19001.861733] sd 5:0:0:0: [sdb] 312581808 512-byte logical blocks: (160 GB/149 GiB) [19001.862969] sd 5:0:0:0: [sdb] Test WP failed, assume Write Enabled [19001.865223] sd 5:0:0:0: [sdb] Cache data unavailable [19001.865232] sd 5:0:0:0: [sdb] Assuming drive cache: write through [19001.867597] sd 5:0:0:0: [sdb] Test WP failed, assume Write Enabled [19001.869214] sd 5:0:0:0: [sdb] Cache data unavailable [19001.869218] sd 5:0:0:0: [sdb] Assuming drive cache: write through [19001.891946]  sdb: sdb1 [19001.894713] sd 5:0:0:0: [sdb] Test WP failed, assume Write Enabled [19001.895950] sd 5:0:0:0: [sdb] Cache data unavailable [19001.895953] sd 5:0:0:0: [sdb] Assuming drive cache: write through [19001.895958] sd 5:0:0:0: [sdb] Attached SCSI disk [19113.024123] usb 2-1: new high-speed USB device number 3 using ehci_hcd [19113.218157] scsi6 : usb-storage 2-1:1.0 [19114.232249] scsi 6:0:0:0: Direct-Access     USB 2.0  Storage Device   0100 PQ: 0 ANSI: 0 CCS [19114.233992] sd 6:0:0:0: Attached scsi generic sg3 type 0 [19114.242547] sd 6:0:0:0: [sdc] 312581808 512-byte logical blocks: (160 GB/149 GiB) [19114.243144] sd 6:0:0:0: [sdc] Write Protect is off [19114.243154] sd 6:0:0:0: [sdc] Mode Sense: 08 00 00 00 [19114.243770] sd 6:0:0:0: [sdc] No Caching mode page present [19114.243778] sd 6:0:0:0: [sdc] Assuming drive cache: write through [19114.252797] sd 6:0:0:0: [sdc] No Caching mode page present [19114.252807] sd 6:0:0:0: [sdc] Assuming drive cache: write through [19114.280407]  sdc: sdc1 &lt; sdc5 &gt; [19114.289774] sd 6:0:0:0: [sdc] No Caching mode page present [19114.289779] sd 6:0:0:0: [sdc] Assuming drive cache: write through [19114.289783] sd 6:0:0:0: [sdc] Attached SCSI disk
6616
Please note: The answers and comments to this  question contains content from another, similar question that has received a lot of attention from outside media but turned out to be hoax question in some kind of viral marketing scheme. As we don't allow ServerFault to be abused in such a way, the original question has been deleted and the answers merged with this question.      Here's a an entertaining tragedy. This morning I was doing a bit of maintenance on my production server, when I mistakenly executed the following command:  sudo rm -rf --no-preserve-root /mnt/hetznerbackup /  I didn't spot the last space before / and a few seconds later, when warnings was flooding my command line, I realised that I had just hit the self-destruct button. Here's a bit of what burned into my eyes:  rm: cannot remove `/mnt/hetznerbackup': Is a directory rm: cannot remove `/sys/fs/ecryptfs/version': Operation not permitted rm: cannot remove `/sys/fs/ext4/md2/inode_readahead_blks': Operation not permitted rm: cannot remove `/sys/fs/ext4/md2/mb_max_to_scan': Operation not permitted rm: cannot remove `/sys/fs/ext4/md2/delayed_allocation_blocks': Operation not permitted rm: cannot remove `/sys/fs/ext4/md2/max_writeback_mb_bump': Operation not permitted rm: cannot remove `/sys/fs/ext4/md2/mb_stream_req': Operation not permitted rm: cannot remove `/sys/fs/ext4/md2/mb_min_to_scan': Operation not permitted rm: cannot remove `/sys/fs/ext4/md2/mb_stats': Operation not permitted rm: cannot remove `/sys/fs/ext4/md2/trigger_fs_error': Operation not permitted rm: cannot remove `/sys/fs/ext4/md2/session_write_kbytes': Operation not permitted rm: cannot remove `/sys/fs/ext4/md2/lifetime_write_kbytes': Operation not permitted # and so on..   I stopped the task and was relieved when I discovered that the production service was still running. Sadly, the server no longer accept my public key or password for any user via SSH.  How would you move forward from here? I'll swim an ocean of barbed wire to get that SSH-access back.  The server is running Ubuntu-12.04 and hosted at Hetzner.
3153
Is there a command to recover/undelete deleted files by rm?  $ rm -rf /path/to/myfile   How can I recover myfile? If there is such a tool how can I use it?
108801
Accidentally a rm -rf command was launched to my root directory instead of current directory. I stopped file removing by Ctrl+C but some files has already been removed. Is there a LINUX command to list all recently removed files from the system to get the affected applications ?  Operating System: CentOS 6.3