rm is the 'remove' command.
5
votes
1answer
1k views
I can't remove a directory tree with rm -rf
This seems very strange to me. I'm running kernel 2.6.37.2 and ran:
~]$ cp -r /proc/ here
~]$ rm -rf here
I get some permission denies when copying as expected and I eventually hit Control-C. I get ...
8
votes
2answers
1k views
How to remove all empty directories in a subtree?
How can I remove all empty directories in a subtree? I used something like
find . -type d -exec rmdir {} 2>/dev/null \;
but I needs to be run multiple times in order to remove directories ...
4
votes
3answers
251 views
Give a warning when something is about to be deleted (by root)
I know that root can do anything, but is there a way to at least alert root that they are about to delete a folder that perhaps shouldn't be deleted?
We keep a work directory in our /tmp folder, and ...
9
votes
6answers
3k views
Deleting all files in a folder except files X, Y, and Z
I have a lot of files and folders in a specific folder and I want to delete all of them; however, I wanted to keep files X, Y, and Z.
Is there a way I can do something like: rm * | but NOT grep | X ...
12
votes
2answers
2k views
How do you run a dry run of rm to see what files will be deleted?
I want to see what files will be deleted when performing an 'rm' in linux. Most commands seem to have a dry run option to show just such information, but I can't seem to find such an option for rm. ...
10
votes
1answer
1k views
What does *~ mean?
At the end of a makefile I saw
rm -f *~ *.class
I understand the *.class, but what's *~?
0
votes
1answer
283 views
Inconsistency in behavior of 'rm' when a mounted volume is involved?
If I run the following sequence of commands:
mkdir dir
ln -s dir link
rm -r link/
I get this output:
rm: cannot remove `link': Not a directory
I get the warning because I could simply have ...
8
votes
7answers
845 views
How do I delete everything in a directory?
I'm sorry for asking such a basic question:
How do I delete everything in a directory, including hidden files and directories?
Right now, I use the following:
rm -rf *
rm -rf .*
26
votes
7answers
3k views
How do I delete a file whose name begins with “-” (hyphen a.k.a. dash or minus)?
How do you remove a file whose filename begins with a dash (hyphen or minus) -? I'm ssh'd into a remote OSX server and I have this file in my directory:
tohru:~ $ ls -l
total 8
-rw-r--r-- 1 me ...
1
vote
2answers
3k views
Delete files in a directory that match a regexp, using a Mac terminal
How do I delete files in a directory that match a given regexp, or a similar solution, using a Mac terminal?
8
votes
4answers
128 views
What is Linux for SET FILE/ERASE_ON_DELETE?
In VMS one may tell the file system to write junk over the existing contents of a file when it is deleted. Here is the DCL command to identify the file for this kind of treatment:
$ SET ...
