rm is the 'remove' command.

learn more… | top users | synonyms

0
votes
1answer
395 views

Undo file removed by rm commend on MAC terminal [duplicate]

I unfortunately deleted .bash_profile file from my MAC. Accidentally I typed rm .bash_profile. Now how can I get my file back?
1
vote
2answers
125 views

Delete files that exist in the source with rsync

I have a folder on server "A" called ./delete. I want to delete everything in the folder ./stuff on server "B" that exists in the ./delete folder on server "A". Its like the reverse of rsync. ...
1
vote
2answers
418 views

delete subfolders without deleting parent folder

For this type of dir structure : /config/filegroups/filegroupA/files/fileA1.txt /config/filegroups/filegroupA/files/fileA2.txt /config/filegroups/filegroupB/files/fileB1.txt ...
3
votes
2answers
110 views

Preventing accidental directory deletion. Making an alias that contains options?

I use an alias to prevent me from accidentally deleting files, and I would like to do something similar for directories. For files, I have the following added to my .bashrc: alias rm="rm -i" I ...
1
vote
2answers
259 views

Removing specific files recursively using rm or something simple?

I have a root folder with a text file in it called pairs.txt. Within that root folder are other folders with text files called pairs.txt in them. Is there a simple way to remove them using rm? I ...
1
vote
1answer
310 views

Where is the trash folder in FreeBSD / PCBSD?

I'd like to delete - undelete files using the shell in PCBSD. But... I don't know where the "trash" folder is. Can anyone tell me?
0
votes
1answer
203 views

Find and remove sub-directories without error?

I need to find a way to remove sub-directories from within a particular directory without receiving an error if no sub-directories exist. This command will successfully remove sub-directories if they ...
2
votes
2answers
160 views

What to do after cancelled “rm -rf /usr/” on Arch?

So I just did this on my up-to-date Arch system: [anna@home ~]$ sudo rm -rf /usr/ ^C[anna@home ~]$ ^C [anna@home ~]$ ^C I terminated the rm very quickly. I can't find anything wrong with /usr/ by ...
0
votes
1answer
89 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
100 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
160 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
361 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
3k 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 ...
6
votes
5answers
441 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 ...
8
votes
4answers
2k 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
169 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
224 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
62 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
87 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
126 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
403 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
793 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
203 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
1answer
228 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
475 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
129 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
157 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 ...
4
votes
4answers
662 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
104 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
531 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
1k 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 ...
5
votes
5answers
1k 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
539 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
330 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
232 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
411 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
136 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?
6
votes
3answers
1k 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 ...
8
votes
2answers
310 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
318 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 ...
6
votes
2answers
1k 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
1k 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
221 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
300 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
261 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
132 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
834 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
480 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
574 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
1k 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 ...