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

learn more… | top users | synonyms

6
votes
1answer
309 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
1k 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 ...
4
votes
3answers
10k views

Emptying the trash takes “forever”: is using rm -r safe to use in Mac OS X 10.7 (Lion)?

Emptying my Trash in Mac OS X 10.7 (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 ...
0
votes
4answers
4k 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. ...
10
votes
3answers
33k 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
813 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 I ...
4
votes
2answers
926 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
4k 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 `/usr/bin/subl':...
3
votes
2answers
255 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 ...
10
votes
4answers
19k 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
747 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
590 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, ...
5
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
170 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
475 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: /Volumes/Temp/vm//...
9
votes
2answers
4k views

Removing files matching a numeric range regular expression

I have a folder which has many files. Some of the data files are labelled 1, 2, 3, ..., 300 I want to remove these data files using the terminal. How do I do this? I want to do something like rm ...
2
votes
3answers
2k views

How can delete all files except one from a directory? [duplicate]

I need to delete all files, except one (its name is defined), from a given directory. How can I do this from the terminal in OS X? Can I do this with one single command?
8
votes
4answers
16k views

Command to remove all files and folders recursively including, hidden ones, on MAC OS Terminal?

rm -rf * will remove all files and folders but not hidden ones. rm -rf .* will remove all hidden files and folders, but not those that are not hidden, correct? What command should one type, in order ...
2
votes
1answer
1k views

Does rm -rf /* command at cygwin affects Windows systems?

I did frequency mistake that rm -rf /* at cygwin console on Windows 7. After a minute I realized what I typed. So I stopped the command by Ctrl-c. I braced myself for re-installing Windows. But ...
5
votes
3answers
1k views

rm on MINGW32, cannot unlink not owner

Similar to rm on cygwin, cannot unlink not owner, but for MINGW32. I tried chmod u+w path but this did not help. user@computer /d $ rm dir -d rm: cannot unlink `dir': Not owner user@computer /d $ ...
0
votes
2answers
477 views

recursively delete but keep .gitignore file

I've been trying out several methods from SU but I have been unable to do this: I got a folder (example: /var/www/tmp/) which contains several files and directories. I'd like to delete all the files ...
3
votes
2answers
341 views

How to limit CPU and disk usage of rm to allow other programs to remain functional

When deleting a large file, rm seems to be hogging all the available CPU and disk resources so that other program are hanging. Is there a way to limit a programs - specifically a CPU or disk ...
2
votes
1answer
246 views

What command sequence can I use to delete directories but not their files?

How do I delete directories but not the files inside them? I have tried the following: rm -di /Users/arthur/Desktop/MyFolder remove /Users/arthur/Desktop/MyFolder? y rm: /Users/arthur/Desktop/...
0
votes
0answers
292 views

bash script rm cannot delete folder created by php mkdir

I cannot delete folder created by php mkdir for I in `echo $*` do find $I -type f -name "sess_*" -exec rm -f {} \; find $I -type f -name "*.bak" -exec rm -f {} \; find $I -type f -name "...
12
votes
3answers
22k views

Delete files with regular expression

I Tried to delete files that starts with A and ends with 2 numbers but It doesn't do a thing. What I tried: rm ^A*[0..9]2$ Where am I wrong?
2
votes
2answers
2k views

Remove directories from a file with list of directories

I have a list of directories in a text file and each of them need to be deleted. How can I read in that list into the command (rm -r or rmdir)?
1
vote
3answers
751 views

I messed up real bad and accidentally did a rm * on Debian 6 while logged in as root

I accidently did a rm * in the / directory in debian 6 while logged in as root. It didn't remove any of the directories, but I seems to have messed up something. rm: cannot remove `132966': No such ...
3
votes
1answer
2k views

restore /dev after `rm`ing it

during a gentoo install from the livedvd, there's one step to create a dev dir to be used later in the chroot of the target for the instalation it's done like that mount --rbind /dev /mnt/gentoo/dev ...
13
votes
4answers
6k views

`alias rm=“rm -i”` considered harmful?

I have read some time ago (can't find the reference) that using such an alias as alias rm="rm -i" was very bad. Is there historical evidence or common sense explanation for that fact? I would ...
12
votes
7answers
9k views

Best practices to alias the rm command and make it safer

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 ...
41
votes
3answers
21k views

Does rm -f follow symbolic links?

I have a directory like this: $ ls -l total 899166 drwxr-xr-x 12 me scicomp 324 Jan 24 13:47 data -rw-r--r-- 1 me scicomp 84188 Jan 24 13:47 lod-thin-1.000000-0.010000-0.030000.rda drwxr-...
2
votes
1answer
240 views

Can't delete some symbolic links on HFS volume (Mac OS X 10.7.2)

I can't seem to delete a pile of files; what all these files have in common is as follows: They're all symbolic links, or otherwise parenting directories They're all owned by an unmapped user and ...
1
vote
4answers
2k views

Where do files and directories go when I run 'rm -rf folder_or_file_name' in Ubuntu 10.04?

When I delete folders or files in the Nautilus GUI, those folders/files go to Trash but where do folders/files go when I run rm -rf folder_or_file_name in terminal in Ubuntu 10.04?
2
votes
11answers
2k views

How can I block execution of rm -rf * in a Linux shell?

I have a habit of typing rm -rf * every time I'm in some kind of sleep mode. It seems that my subconscious wants me to delete everything I code at the end of the day. Is there a way to block this ...
0
votes
2answers
107 views

How to delete a file after processing

I am using mp3splt to split all the .mp3 files under a directory, including subdirectories, into 30 minute slices. find -name *.mp3 -print0 | xargs -0 mp3splt -t 30.00 -o @f_@m@s What is the best ...
0
votes
1answer
112 views

How to remove files that start with 2011XXXX

I have a bunch of files i need to delete, they all start with 2011XXXX. How would i delete them. So far i have this command: ls | grep 2011 | xargs rm And it works, but is there a better way to ...
0
votes
2answers
3k views

How can I remove a directory with rm - rf?

I try to remove a folder with rm -rf foldername … but it says rm: cannot remove folder :is a directory. What's wrong?
1
vote
3answers
353 views

How do I remove TextMate's temporary files using rm?

Note that I'm not trying to disable the creation of these files. I want to keep them around until I'm ready to commit changes to my source control. The files are scattered throughout many ...
1
vote
2answers
1k views

Remove all except one file and directory at path

I need to remove all the files in a directory except for one file and one folder. Up to the grep I can output the correct list of items I want to remove but when i add xags, nothing is deleted. this ...
5
votes
3answers
1k views

Why is the dreadful 'rm -rf /' even allowed? [closed]

We all know the destructive power of the following command executed as root: rm -rf / Related questions: How far will you get with a 'rm -rf /' deleting everything: # rm -rf / I fail to ...
18
votes
4answers
715 views

Getting rid of a file called “-d” [duplicate]

Possible Duplicates: How do I delete a file named "-p" from bash? How to delete file with this name on linux: -]???????q Removing "-rf" file in Unix I've accidentally ...
16
votes
4answers
39k views

Linux – cannot remove owned file with 777 permissions

I've couple of files that I cannot remove using rf -Rf command. I'm the owner of those file and the group assigned to those files is also a group my user is in. What's even weirder is that I can edit ...
2
votes
3answers
817 views

(Probably) trivial question about rmdir

I hope this isn't too trivial, but for some reason I can't get a simple command to execute. I'm writing a file manipulation script and I have several directories called test, test2, etc each ...
1
vote
0answers
194 views

I deleted a C file from my system using rm-rf [duplicate]

Possible Duplicates: How to recover a removed file under linux Undo an “rm -rf ~” command? I deleted a newly created C file from my system. My assumption was that I did a svn ...
5
votes
3answers
796 views

Safe substitute for OS X `rm`?

I am used to having rm to alias something safer. I have been using osx-trash, but once I upgrade to Ruby 1.9.2, this stops working. I know about trash-cli from Python, but I would much prefer ...
191
votes
9answers
14k views

How far will you get with an 'rm -rf /' command?

I've often wondered how far the system will actually get if you run rm -rf /. I doubt the OS would be able to erase itself (?) Bonus Question: After the command has been executed, will rm have ...
0
votes
2answers
2k views

Help. I ran “find / -mtime +1 -exec rm {} \;” by accident!

I'm very very tired, worked all night long, and I did't sleep for hours... So I'm like a zombie now... half awake, and half asleep. I was trying to clear a directory. Then I run the command cd to ...
3
votes
2answers
822 views

When does rm remove open files?

Particularly, I want to know what happens when I rm an open file and don't explicitly kill the process holding the file descriptor to that file. Will the file be removed when the system is shut down?