rm is the 'remove' command.
0
votes
1answer
49 views
rm -r path : how to avoid being asked at each level?
How to avoid being asked at each level if I want to delete that path? I just want to remove everything in a path?
0
votes
3answers
57 views
How to delete directory ' :q!'? [duplicate]
Accidentally, i have got this directory created in my home,
drwxr-xr-x 2 ubuntu ubuntu 4.0K 2012-09-06 07:27 :q!/
I want to remove this somehow. I have tried using escape characters in double ...
2
votes
2answers
63 views
dowload find binary , accidentally deleted /usr/bin/find binary file
I accidentally deleted all some binaries by rm -r f*, when my current directory was /usr/bin/ . So i couldn't install any files including findutils, since 'find' binary is the prerequisite for ...
1
vote
1answer
55 views
I can't seem to remove a file even after changing ownership and permissions [duplicate]
Haven't been here much. Mostly Stackoverflow. Anyway, I have a file that I can't remove.
I tried sudo rm files.db and got
Operation not permitted
Did sudo chown me: files.db
Then sudo chmod 777 ...
3
votes
1answer
114 views
Move files and delete directories with rsync?
Recently I needed to delete a large number of files (over 1 million) and I read that doing:
rsync -av --delete `mktemp -d`/ ~/source && rmdir ~/source
Was one of the most optimized ways to ...
4
votes
4answers
207 views
Making a directory protected from 'rm -rf'
I just lost some data in folder A which was inside folder B after doing rm -rf B. Before I could realize what have I done, it was all over. Now a lesson is learnt, I wish to make some of my folder ...
3
votes
4answers
107 views
rm -rf all files and all hidden files w/o . & .. error?
rm -rf /some/path/* deletes all non-hidden files in that dir (and subdirs).
rm -rf /some/path/.* deletes all hidden files in that dir (but not subdirs) and also gives the following error/warning:
...
0
votes
3answers
53 views
What does ./ mean? [duplicate]
I'm having a hard time getting what ./ does.
In the Linux Essentials books, it asks me in an exercise to delete a file named -file. After googling, I found that I need to do rm ./-file but I don't ...
1
vote
2answers
46 views
Cannot remove /log/var/snort as root
I am using Ubuntu 11.10 Gnome.
I uninstalled snort in order to install a more recent version. The new installation initially failed because the system would not let be rm or modify /var/log/snort ...
0
votes
1answer
40 views
Not able to remove a file [duplicate]
file name : abc
permissions : -rwxrwxrwx
shell : ksh
I am logged with the user which is the owner of this file.
Contents of file
AccessTime = 20130424-161120 ActualShmKeyDec = 1090650862 ...
1
vote
1answer
75 views
What exactly would happen if this command were run?
A simple curiosity... assuming running as root what would the following command do?
# mv / /dev/null
Would it be a faster death than rm -rf from the root of the tree?
0
votes
2answers
64 views
why am I able to delete file which belongs to `root` under a non-root user? [duplicate]
I create a file under my user esolve
and then su root
and use chown to change its user to root
then I returned to user esolve
I notice I can still delete the file with rm
why?
0
votes
3answers
51 views
Rm command recovery for this situation
İn my desktop, i have a dir. called exam, and i wanted to remove it from the console and wrote rm * /exam, and apparently it removed some other files from my desktop. Please tell me that there is a ...
1
vote
2answers
114 views
how to change `rm` to as a command like `mv ~/ .trash` [duplicate]
I like to use rm
but I often made mistakes so that I remove something mistakenly
so I want to make somthing like mv .trash
so that
rm file
is equal to
mv file ~/.trash
besides, I also ...
1
vote
2answers
95 views
How to avoid the need to issue “y” several times when removing protected file
I'm looking for a solution to be used as
a response to "rm: remove write-protected regular file [x] ?"
I was thinking of issuing a character followed by carriage return for several amount of times, ...
0
votes
0answers
65 views
How to safely remove hard-link to home folder?
In a folder owned by my user /sites/Website there is a dir named ~.
When I cd to this directory, I am redirected to ~/, my home folder.
At first I thought this was a symbolic link, but doing ls ...
2
votes
1answer
117 views
“rm -rf Filename.iso ” Permission denied
Hi I am facing an issue while deleting an .iso file from Linux x86_64 GNU/Linux.
Here are the permissions for the file:
# ls -lrt
-rwxrwxr-x 1 dev devgrp 2687934464 Apr 12 14:13 ...
1
vote
8answers
112 views
remove content of directory in elegant way
I would like to remove all content of the current working directory.
How to do it in efficient and elegant way?
I have several files, directories and some of them starts with dot, like:
touch .abc; ...
1
vote
2answers
124 views
Can't remove same folder name twice
I have a folder called - bin , then I remove it by rm bin , re-create it and when I want to remove it again by rm bin the shell promts -
/bin/mv: cannot move `bin/' to ...
3
votes
4answers
186 views
How to remove files which do not end with “.c”?
I have a directory which contains all the C programs. I have also compiled them at the creation time so as to check my code. There are a lot of programs nearly 100 of them. So I want a BASH script ...
1
vote
1answer
45 views
Able to delete file without permission [duplicate]
I've been experimenting with file permissions and ownership lately, and I tried this:
touch a
sudo chown root:root a
sudo chmod 000 a
I can't read, write, or execute the file, but I can still ...
5
votes
4answers
364 views
How to forbid the execution of /bin/rm -f *?
I cannot remember how many times I've listed a subdirectory and executed /bin/rm -f * in the current directory. Can anyone give suggestions to help me avoid this? What should I do if I want the system ...
5
votes
3answers
292 views
How do I remove all sub-directories from within a directory?
This question is kind of a phase II to the first question I posted at here
I have a directory that contains a bunch of sub-directories, .zip files, and other random files not contained within a ...
4
votes
5answers
164 views
Delete files in directory without erroring if it's already empty
As part of a deployment script, I want to dump some cached stuff from my temp directory. I use a command like:
rm /tmp/our_cache/*
However, if /tmp/our_cache is empty (fairly common when pushing ...
10
votes
2answers
441 views
What's the reason for this specific “rm” sequence in the xkcd joke?
Here's part of this xkcd comic strip where the idea is that the author can't write a sort program so he adds code to delete all files
system("rm -rf ./");
system("rm -rf ~/*");
system("rm -rf /");
...
0
votes
3answers
92 views
Safe Directory Delete
I alias rm to rm -i so that when I mistype file* as file * I get prompted before accidentally deleting files I didn't intend to delete. Is there an equivalent idiom for directories?
In particular, ...
1
vote
2answers
105 views
Why rm command unrecognized w flag in AIX?
I have a bash script that retain the last 5 copies in AIX like this:
rm `ls -lt /path/the_file_* | tail -n +6`
But I get this error:
rm: Not a recognized flag: w
UPDATE
The ls command return ...
0
votes
2answers
98 views
Remove soft link but not the target
I have a directory that contains a link to another directory that I just created. I would like to remove the link but preserve the directory my link was pointing to. How do I do this?
> mkdir rgac
...
1
vote
1answer
70 views
How to find undeletable files that were removed?
I just created a file:
touch myFile
Made it "undeletable":
chattr +u myFile
and removed it:
rm myfile
How can I get it back? What is the purpose of "u"? Is it used?
5
votes
3answers
439 views
How can I delete a folder with lots of subfolders fast?
I have a folder with 266778 subfolders. How can I delete it?
I have tried
cd ~/.local/share/Trash/
sudo rm -rf *
but it takes much time. After 1 minute 25 seconds real time and 0.072 seconds user ...
7
votes
2answers
261 views
Why do `cp` and `rm` treat directories separately?
Why do tools like cp and rm treat directories separately from regular files? They both require the user to explicitly specify she wants a recursive behavior, or else they won't deal with directories ...
6
votes
2answers
163 views
Remove all Vim undo files in all but one directory
I just realized that I have tons of Vim undo (.un~) files sprinkled around my file system. I'd like to delete all of these files except in one directory—~/.tmp. My first problem is that I can't seem ...
4
votes
2answers
272 views
How to execute command on list of file names in a file?
I have listed the names of the files which are to be deleted into a file. How can I pass the file to rm command so that it should delete them one by one.
3
votes
2answers
453 views
find flags: -exec rm -rf vs -delete
I thought the flags I mentioned in the question are the same, but I get the following message with the former, but nothing with the latter:
$ find . -mindepth 1 -type d -exec rm -rf {} \;
find: ...
1
vote
1answer
125 views
Killed `rm` and `cp` on nfs share
I am just testing an rsnapshot installation on my laptop which should backup to a NAS mounted via nfs on my laptop.
On one test rsnapshot died with a cp -al problem (i.e. a problem with hard links) ...
1
vote
1answer
111 views
Speeding a find rm command with test through parallelization
I want to recursively delete all files in directories and subdirectories with number of lines less than 10, and am currently using the following command
find . -type f -name "*.txt" | while read; do ...
2
votes
2answers
198 views
When we do rm -rf * why we do not delete . and ..?
I am just curious. Is there a save guard there? . and .. is a "subdirectory" of the directory we are deleting right?
I know it's not a subdirectory but linux treat it as a file with directory ...
2
votes
2answers
101 views
What is an equivalent of rm `find lib/ -name *.swp` without find?
As in the title, I would like to remove all files in the lib directory with .swp in the end.
How can I do this without find in:
rm `find lib/ -name *.swp`
6
votes
6answers
358 views
How to prevent a mistaken rm -rf for specific folders?
I think pretty much people here mistakenly 'rm -rf'ed the wrong directory, and hopefully it did not cause a huge damage.. Is there any way to prevent users from doing a similar unix horror story?? ...
3
votes
2answers
201 views
rm -fr not working
I have a directory that was generated by mistake by an application and this directory has a structure that involves more than 2000 directories, one inside a another, something like:
Directory aaaa ...
0
votes
1answer
325 views
Shell script to delete all files which are older [duplicate]
Possible Duplicate:
Deleting files by age
Write a shell script to delete all the files which are "n" of older that current day, where n can be 3days. 2days, or 1 year etc. The above script ...
5
votes
5answers
608 views
Delete all folders containing files which match pattern
I'm trying to delete all subdirectories of my current working directory which contain a rar file.
My first attempt: find -name *.rar -exec rm -r {}/.. ';' failed because that is not a valid ...
1
vote
1answer
161 views
How to delete a file to the trash in BASH (Linux) [duplicate]
Possible Duplicate:
Make `rm` move to trash
I've looked everywhere for the answer, but I can't find it.
Is it possible to move/delete a file to the trash folder on linux. But also having ...
1
vote
1answer
308 views
Can't delete symbolic links, permission denied
I try to delete all symbolic links pointing to Python3.2 with
sudo ls -l . | grep '../Library/Frameworks/Python.framework/Versions/3.2' | awk '{print $9}' | xargs rm
This just gives
rm: 2to3: ...
0
votes
4answers
256 views
Configure rm command
I want to configure rm command. When one types rm to delete a file, then instead of deleting it right away, the file has to be transferred to the .trash of home folder. Can someone help me ?
3
votes
3answers
298 views
rm option to fail on nonexistent files
The man page of rm in GNU coreutils 8.12.197-032bb describes the -f or --force option as "ignore nonexistent files, never prompt". Without this option, it will remove any existing files, never prompt, ...
9
votes
2answers
407 views
Interactively deleting files from a list
I'd like to remove a list of files and be asked for confirmation. The list is in the list.txt file. Why the following command doesn't work properly?
while read i; do rm -i $i; done < list.txt
...
3
votes
1answer
1k views
Cannot delete a file - permission denied - why?
[db2inst1][testing ~/sqllib/db2dump] rm db2diag.log
rm: cannot remove `db2diag.log': Permission denied
[db2inst1][testing ~/sqllib/db2dump] id
uid=1002(db2inst1) gid=107(db2iadm1) ...
3
votes
2answers
2k views
undo rm -r, restore data
I was playing around with zip and accidentally deleted my /home/ folder (i wanted to delete home/ which got created by unzipping an archive).
I used rm -r /home/instead of rm -r home/ as root...
Is ...
25
votes
2answers
4k views
Why can rm remove read-only files?
If I create a file and then change its permissions to 444 (read-only), how come rm can remove it?
If I do this:
echo test > test.txt
chmod 444 test.txt
rm test.txt
...rm will ask if I want to ...