rm is the Linux Posix command to remove and delete files or directories.

learn more… | top users | synonyms

1
vote
1answer
292 views

Slow directory removal (rm -rf) on Max OS X

Can anyone help me diagnose why removing a directory would be so slow on my Mac? $ du -hs mydir/ 606M mydir/ $ find mydir/ -type f -print | wc -l 12720 $ date Tue Sep 10 10:59:27 PDT 2013 $ rm ...
4
votes
1answer
288 views

How can I remove all files from a directory that have a certain filename length?

I have a tmp directory full of various files that a program has created and not cleaned up properly. Each of these files has a filename that's simply 6 random characters. In addition to these, there ...
5
votes
1answer
964 views

How to delete the contents of a USB Stick in Linux

I'm not looking to format the stick at all, but rather to iterate through the files deleting them all (though after typing 'iterate through' I can sense a Python script coming along. So far I've ...
0
votes
2answers
128 views

`sudo rm -rf /` got interrupted leaving the data partially deleted

I ran sudo rm -rf / to wipe out all data, for some reason the execution got interrupted. Now I am left with a shell that only has cd command!!! (ls, sudo, rm, etc got deleted!) What should I do to ...
0
votes
1answer
769 views

rm -rf does not delete folder contents but instead creates another empty one

I'm currently writing a start script for a minecraft game server. In this script I included a backup script. This backup script works almost perfect but instead of deleting a folders contents it just ...
-4
votes
2answers
454 views

Preventing execution of sudo rm -rf /*

Do any Linux distros prevent the execution of sudo rm -rf /* so that people do not accidentally delete their hard drives if they did not know what they are doing?
1
vote
1answer
1k views

Use 'find' to find and delete large files of a certain type

I am trying to find and rm -rf large files in RHEL, but what I would expect from this command that would give me purely the file directories, feeding them into rm -rf, it is not removing them. My FU ...
-1
votes
2answers
102 views

Behaviour of “rm -r”

Up until now I was using Ubuntu, and the behaviour of rm for directories was the following: rm -r dir would remove dir if it was empty, and give an error otherwise rm -rf dir would remove dir and ...
17
votes
3answers
2k views

How can I remove a file or directory called “\”?

I'm using terminal on a Ubuntu machine and there is a file that I would like to delete. The file's name is \ (just a backslash). Now usually I would just do rm filename However if I do rm \ then ...
3
votes
1answer
2k views

How do I remove a possible hard-link directory to root?

I know hard links to directories aren't supposed to be possible but it I have something odd on my NAS that looks very much like one. This folder originally came from a linux machine and appears to ...
0
votes
1answer
208 views

Does interrupting rm command with keyboard delete any file?

I'm running Fedora 13 (Goddard) and when I was recursively removing a directory I noticed I had some files there I couldn't lose, so I interrupted the process with ctrl+c. Now I don't know if I lost ...
-3
votes
2answers
2k views

“rm -rf /” VS. “mv -r / /dev/null”

Might be a stupid question, but what would be the worst for your system ? (I think both) But to my opinion mv would be the fastest to "delete" it all. Am I wrong ? (don't wana test aniway ^^ )
1
vote
1answer
185 views

Avoiding accidental 'rm' disasters

Today, using sudo -s, I wanted to rm -R ./lib/, but I actually rm -R /lib/. I had to reinstall my OS (Mint 15) and re-download and re-configure all my packages. Not fun. How can I avoid similar ...
0
votes
2answers
609 views

Accidentally “rm -rf /” in OS X [closed]

Some background to maybe help others from making this mistake. I was reading jokes from this Stack Overflow page to my friend ...
3
votes
1answer
332 views

rm -r only files?

Is there an way to remove all the files from the current dir (recursively), keeping the directory structure?
2
votes
1answer
418 views

Removing a directory containing a file using find

I'm searching a list of directories for certain files and I want to delete the directory that the file is in. This is what I'm trying: find /converter/storage/unmatched/ -size -4b -name '*.mp3' ...
1
vote
2answers
2k views

Delete directory and subdirectory - Operation not permitted

There is a folder called Trash-1000 and i want to delete it. There are some folders in it which cannot be deleted (do not even know how they were created). Looks like: ...
5
votes
3answers
738 views

I just ran rm /* accidentally, any fix?

I fell so stupid... I just ran rm /* accidentally, but I meant rm ./* on a cloud server with root access. Now, no one command works. ls, ssh, sftp... none. Is there a way to fix that? (Note: params ...
0
votes
2answers
240 views

How can I prevent bash from executing 'rm' when ' * ' is one of the arguments?

I wish to insure myself from accidentally using rm [argument_i] * [argument_j] i.e. it should always refuse to execute the command, when the asterisk character is separated by white space on both ...
1
vote
1answer
154 views

Removing all directories in a given path with unix

I have a directory containing lots of files and lots of empty directories. I want to keep the files but remove the directories. How can I achieve this using rm and other standard unix tools?
2
votes
1answer
1k views

Is it possible to remove the root directory?

I noticed in the documentation for rm as obtained by rm --help the following flag: --no-preserve-root do not treat `/' specially What does this mean? Is it actually possible to delete the root ...
1
vote
4answers
1k views

Is there any rm log with removed files?

Is there any way to check what was recently removed with rm command?
1
vote
2answers
128 views

Does RM corrupt when interrupted?

So I may have kind of accidentally rm -r'd ~. Not to worry, I have backups! I did a quick file listing diff to copy across files that were removed, all is good. But... Does GNU rm corrupt files if I ...
2
votes
1answer
1k views

Undeletable file in RedHat Linux

There is a file under my home area that I cannot delete. When I do an ls -al on the directory, the permissions are ?--------- and there is a ? for user, group, size and date columns. When I attempt to ...
3
votes
1answer
42 views

OS X - DEAAD300 File Can't be seen via Terminal or Deleted

OS X - 10.7.5 I have a file DEAAD300 on a users desktop that I can not delete. EDIT - The file can not be opened either. The icon that shows up looks like an Excel file (The user has Office 2011 ...
1
vote
2answers
371 views

How can I recover from mistaken 'rm *'?

I just typed rm * in the wrong directory by mistake. I had the wrong terminal window highlighted. What are my options?
-2
votes
3answers
556 views

A file which is not a dir nor a file

This may look like a weird question, but I just got this output for a file (directory?) in my system. This may be a trivial or well-known error, but for me, this file (directory?) called ...
1
vote
1answer
310 views

rm !(myfile) does not work on OS X?

The command works fine on Linux but on OS X Mountain Lion when I'm doing: rm !(myfile) bash complains: bash: !: event not found Is there any way to do it the same on OS X?
95
votes
16answers
62k views

How to delete all files in a directory except some?

I need to delete all files in a directory, but exclude some of them. For example, in a directory with the files a b c ... z, I need to delete all except for u and p. Is there an easy way to do this?
0
votes
2answers
460 views

How to delete all files & directories in a directory including hidden ones except .htaccess?

As the question suggests, I have a situation where I have a folder that users can upload weird stuff there. Have a cron job set up to clean this folder every a few hours. It has a .htaccess for ...
7
votes
3answers
773 views

How to remove a file with unprintable charaters in Mac OS X Terminal [duplicate]

Possible Duplicate: Removing file with strange characters in filename in OS X I have a folder that has a file who's name is Icons and ends with an additiona unprintable character. I can see ...
3
votes
2answers
101 views

Deleting Certain Extension with Bash (quickly)

I have seen other threads about deleting a certain extension in a directory. However, when I try it, it seems to work but takes a long time to go through directories and say "Permission denied" on ...
0
votes
0answers
61 views

How can I tell whether an interrupted rm -r removed any files?

I installed sshfs a Linux box and then mounted my Mac home directory. In the middle of troubleshooting a configuration issue, I did an ls -l on the mount directory (as normal user), receiving: total ...
5
votes
1answer
224 views

Explaining the -W flag for rm

What does the -W flag for rm do (on BSD or Mac OS X)? According to its man page, the flag attempts to "undelete the named files." And currently, "this option can only be used to recover files covered ...
1
vote
1answer
2k views

Cleanly Remove MAMP Pro

I'm trying to cleanly remove MAMP Pro from my Mac and I'm following the steps outlined in the SO article http://stackoverflow.com/questions/11855247/mamp-pro-restore-root-user-uninstall. I have been ...
1
vote
2answers
598 views

Deleting a file with question marks in the name (another encoding) in Debian

I have a file with the name like ?????????????????????? ???????????????????????? ??????????.png in my directory. It seems to me that file was created under windows with russian name. I pulled it with ...
3
votes
3answers
8k views

OS X Lion: Emptying the trash takes “forever”: is using rm -r safe?

Emptying my Trash in OS X Lion (non securely) is taking about three hours (about 1.5 million files, from a Time Machine backup). I had to stop the process a few times already, because I could not move ...
0
votes
4answers
2k views

How to recursively remove all .exe files from all the subdirectories of the current directory?

I have a USB containing important files. However it is infiltrated with some unwanted .exe files (probably virsuses) in each subfolder. Since I am on a Linux machine, the exe files won't affect me. ...
8
votes
3answers
21k views

Can files deleted with rm -rf be recovered?

When I delete folders or files in through osx terminal using the rm -rf, where do they go? I heard that some say they are deleted directly, but some also say it only "remove the link to the file ...
0
votes
1answer
652 views

Recover files that were rm [duplicate]

Possible Duplicate: Can files deleted with rm -rf be recovered? How to recover files that are rm -rf? Because, I know they aren't deleted at that point. I am using OSX 10.7, is there an app ...
4
votes
2answers
668 views

Does rm work alphabetically?

I had many files in a folder in which I accidentally ran rm * before interrupting. It looks like files starting with a, b, and c are gone, but I am not sure, as I didn't know the name of all the ...
2
votes
1answer
3k views

removing symbol link with too many levels of symbolic links

I created a link by the command sudo ln -s /etc/Sublime\ Text/ /usr/bin/subl Now I am trying to remove it with sudo rm -r /usr/bin/subl/ But it is telling me rm: cannot remove ...
3
votes
2answers
207 views

What is the point of UNIX's rmdir?

I'm new to UNIX (MAC OS X bourne shell POSIX), I understand rmdir will only remove an empty directory but under what circumstances would you actually want to use rmdir <directory name> and not ...
6
votes
4answers
11k views

Trying to delete directory with “rm -rf”, but get message that it's not empty

I've tried deleting a directory using "rm -rf" and I'm getting the message "Directory not empty": Bens-MacBook-Pro:please benjaminhocking$ ls -lart empty_directory/ total 16 drwxr-xr-x 5 ...
0
votes
2answers
2k views

How to recover deleted file in Linux [duplicate]

Possible Duplicate: How to recover a removed file under linux I have run the rm -rf * command mistakenly at the [user]@localhost location. Because of that I lost all the files in my user ...
0
votes
3answers
737 views

How do I boot into Windows after erasing all my files in Linux with rm?

I have a Lenovo IdeaPad with Windows and Backtrack 5 r3 dual boot. My friend typed in rm -fr /* >null on my computer that erased everything. After it was executed I couldn't do anything so I ...
0
votes
1answer
297 views

Deleting a file if it exists or not

Here is a part of my zshrc file. ## Most Frequently used settings # ls alias ls='rm .DS_Store; echo --------------${PWD##*/}--------------; ls -1FGu' alias l='ls -A' I want to delete .DS_Store, ...
4
votes
1answer
7k views

Deleting files doesn't free space

I've got a disk formatted as ext3, which was filled completely. I'm attempting to free up some space on it by deleting files, but it's not working. I can rm the files, and they don't show up in the ...
1
vote
3answers
165 views

Does rm -rf continue on reboot?

I just did a big mistake — I did rm -rf /home/. I can't afford to lose this data so I quickly did a reboot. Then I was trying to roll back some of the damage it had done. But now I am struggling to ...
0
votes
0answers
423 views

How to delete *.vmdk files?

I can't seem to delete *.vmdk files and related on Mac OS X 10.6.8 with sudo rm: $ sudo rm -rf /Volumes/Temp/vm/ rm: /Volumes/Temp/vm//MarukoVM/nvram: Read-only file system rm: ...