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

learn more… | top users | synonyms

1
vote
1answer
23 views

Unable to rm -rf .nfs0000000008547f6500007f62 file on linux server

When I do a rm -rf directory It says a message like : rm: can't delete directory/.nfs0000000008547f6500007f62 ressource occupied and I don't know why.
0
votes
1answer
33 views

How to remove file on Linux with ? in name

Cannot move or remove file with ? in name. Any ideas? Have tried the following: # ls manager?%80%99s-viewpoint.html what-wcsap-can-offer-you-?%80%93-guide-new-directors.html # mv manager\?%80%99s-...
0
votes
0answers
33 views

How to make a busy file not busy so it can be deleted. rm: filename: Resource busy

I have somehow generated a file on a network mounted volume that is in the busy state, and I have no knowledge of what could be using it. I want the file gone, and am not really concerned about ...
0
votes
1answer
24 views

Delete all the folders and file except one folder

I want to remove all the folders and files but except one. I have a Ubuntu server and I tried several methods and none of them worked. This is my folder structure. app app/public app/public/uploads ...
1
vote
2answers
52 views

Root user can't remove folder

There is a folder /mnt/shared which root user can't access/modify or remove. # ls -lai /mnt total 4 16662 drwxr-xr-x 3 root root 0 Mar 27 14:30 . 2 drwxr-xr-x 23 root root 4096 Mar 27 14:26 ....
0
votes
0answers
32 views

Have I messed up Time Machine backup?

I recently had a full power outage which happened in the middle of a Time-Machine backup to a Time Capsule on my network over WiFi. I've only recently got and started using the TimeCapsule device but ...
1
vote
1answer
38 views

unable to remove symbolic links of rsync copy of /bin and /dev

I accidentally made a rsync copy of my root directory, "/" using the -a option, as follows: user@mycomputer:~$ rsync -a / /backup-dir user@mycomputer:~$ ls -l /backup-dir/ total 10102784 drwxrwxrwx 1 ...
0
votes
0answers
56 views

Remove backups older than 7 days except first of every month

I want to delete backups older than 7 days but keep the first of every month. The name of the files is name_$(date +\%d\%m\%Y).tar.gz I want to keep name_$(date +\01\%m\%Y).tar.gz I want something ...
1
vote
1answer
23 views

Recursive removal, preserve directories in Linux

In a Linux command line is it possible to - without prompting - recursively remove files (like with rm -r [path]), but preserve directories under [path]? EDIT: For the interested, I've used Paul's ...
0
votes
1answer
49 views

User can't delete file owned by user with w permission

I've a backup system based on rsync. Get a problem when try delete one file srv106@storage10:~$ rm -vf /srv/storage/homes/srv106/daily/files/daily.32/root/.my.cnf rm: cannot remove `/srv/storage/...
-1
votes
3answers
50 views

Remove all files but one folder with rm

I want to use rm -rf to remove files/folders inside a folder, but skip or ignore a specific folder. It has been suggested as duplicated to another quesiton, but that is not the case. The other ...
0
votes
0answers
128 views

10.11 rm -rf Facetime

I try to get rid of Facetime (then auto call link on random number is annoying me too much) I've try rm -rf /Applications/FaceTime.app/ but never have enough privilege (operation denied) Sudo is ...
0
votes
1answer
195 views

How to kill/rm pipe by inode number only?

EDIT: I originally cut and pasted a question I'd asked earlier on stackoverflow that got closed: http://stackoverflow.com/questions/32622224/how-to-kill-pipe-by-inode-number-only I've now run into ...
-3
votes
1answer
263 views

Couldn't remove a directory, already tried rmdir -rf

I kept on trying to remove a folder in the server, but I kept on getting a same error. Please help me. I used this post as a reference http://askubuntu.com/questions/217893/how-to-delete-a-non-empty-...
0
votes
0answers
40 views

Accidentally partially deleted home directory . . . Killed with ctl-c, which file is corrupted?

I was running some software in my home directory (last time I do that!). Stupid config file asks what directory I wanted to put my output files. I accidently used ~/ as my output directory. It ...
0
votes
2answers
89 views

override environment variables

I would like to override a particular environment variable on a one-shot basis. The system currently has a variable for the "rm" command, forcing verification for each file. In general I am fine ...
0
votes
0answers
54 views

Linux: Delete all but x files?

I have a series of files with different IDs: File_ID1_1 File_ID1_2 File_ID1_3 File_ID1_4 File_ID1_5 File_ID1_6 File_ID2_1 File_ID2_2 File_ID3_1 File_ID3_2 File_ID3_3 For every ID there is a defined ...
0
votes
1answer
69 views

rm -rf / on a virtual machine?

So, this is probably a stupid question, but I'm genuinely interested. Would it be safe to recursively delete everything on a virtual machine from a command line, just for fun? I'd assume so, given ...
0
votes
0answers
5 views

How to delete a file named `aux` [duplicate]

I have a file named aux in a directory ...> ls aux ...> dir Wolumin w stacji C nie ma etykiety. Numer seryjny woluminu: ... Katalog: C:\Users\...\config 2015-07-15 23:14 <DIR> ...
1
vote
2answers
37 views

Deleting specific folders recursively

The folder structure is as below A/B/C1/ A/B/C2/ X/B/C1/ X/B/C2/ I want to delete all C2 folders however keep C1 intact. What is the correct command for that?
1
vote
2answers
34 views

How to delete all files and directory except one named directory from a specific folder in centos [duplicate]

I want to delete all files and directories from a specific directory except for one directory. For the same operation I had run this command # rm -R -df !(dir_name_not_to_delete) It works in Ubuntu ...
0
votes
2answers
75 views

understanding the -R flag and * in rm commands

When using the rm command in OS X 10.9 I accidentally deleted an entire disk. As I understand the command I used: sudo rm -Rfv /Volumes/Disk/AppName\!\ Whatever\ X.app/Contents/Resources/* ...
1
vote
2answers
42 views

Recover Partitions deleted by rm

In my PC I have 3 NTFS partitions 1 for Windows Boot Loader, next one is windows installation directory and the last one is for storing my whole data. They were mounted like this /dev/sda1 => /...
0
votes
2answers
260 views

What is the command to remove all files and folders, on mac os x terminal?

On Mac OS X terminal, how can we remove all files and folders, including hidden ones, recursively, except one directory? Thank you.
0
votes
1answer
72 views

Accidentally deleted all files older than 7 days

A bad written skript located in /etc/cron.daily erroneously executed find * -mtime +7 -exec rm -r {} \; as root user. As a result of this I can no longer login. Beside that the system seems to run ...
2
votes
2answers
444 views

How to recursivly delete all JPG files, but keep the ones containing “sample”

How can I find and delete all the .jpg files in a directory tree with the exception of the ones containing "sample" in their filename? For example : a.zip -> keep it b.jpg -...
1
vote
1answer
553 views

Can't rm or cd into directory [duplicate]

I found a directory on my machine called "Previous System" that looked old and useless and I tried to delete by dragging to the trash and emptying the trash. That failed to delete the directory, ...
0
votes
2answers
353 views

Delete All Files Older Than Specified Time Within A Directory (Ubuntu)

I have a bunch of files in a directory with all different names and I want to delete all that are older than a specified time. Example: File1 File2 File3 File1 was made Mar 31 08:00 File2 was made ...
1
vote
1answer
112 views

What does rm --preserve-root prevent exactly?

Modern rm by default has the --preserve-root option enabled, but what exactly does this prevent? I understand it will prevent rm -r / (right?) but does it prevent cd / rm * or rm /* for ...
2
votes
1answer
186 views

Is there any difference in power between sudo rm and sudo rm -f?

Simple question, but I'm not sure I got a complete understanding from man rm. To the best of my knowledge the only difference is that adding the -f will plow through files without prompting and ...
31
votes
10answers
3k views

Prevent user typing accidental space between rm and wildcard

Intention: rm -rf string* Problem: rm -rf string * The first case is a legitimate and common use of rm, a small typo can cause a lot of problems in the second case. Is there a simple way to ...
1
vote
1answer
115 views

Deleting unpacked tar.gz files after unpacking incorrectly

I recently unpacked a set of backup files in RHEL3 - 2.4kernel with tar via: tar -xvf backupfile It started to error out a bunch and I aborted thinking that maybe it was a gzip instead. Unpacking ...
0
votes
1answer
470 views

Filesystem device on a VPS

I did some bullcrap on my VPS and accidentaly deleted wrong files. Now I want to recover them with extundelete but I can't seem to find the filesystem device on my VPS. I tried ls -la /dev | grep ^b ...
0
votes
0answers
401 views

Bypass the $Recycle Bin in CygWin?

I'm using a CygWin session to find a large number of directories at a certain level in the file system tree in a loop, compress each directory into 1 archive, then delete the directory This ...
0
votes
0answers
120 views

rm -rf * results in “Killed”

I used PHP to generate about 4,000,000 files in a directory (f/) because I was bored. When I cd .. and use rm -rf f, it simply returns "Killed" about half a second later and does not delete the ...
0
votes
2answers
260 views

Why does `rm -rf`` silently fail?

[EDIT] Please don't waste your time reading my question below. It turns out my colleague is an idiot.. :) On my server I'm trying to remove a folder and all its subfolders with the usual rm -rf ...
0
votes
1answer
51 views

How much dangerous rm -rf is?

Does rm -rf dir/ erase filesystems mounted below dir/ (say in dir/a)?
0
votes
3answers
5k views

Removing Hidden Files in folder

I am having some trouble removing a particular folder on my harddrive. I have tried the conventional approach of rm -rf req (where req is the filename) however this failed. running ls -...
1
vote
0answers
470 views

Ubuntu: How to get my data back after sudo rm -r *? [duplicate]

Given an user made a clean and successfull: sudo rm -r * #erase all folders and files recursively starting from root How to get all the hard drive's data back ?
0
votes
1answer
390 views

Permission denied on sudo remove

I have two users userA and userB. userA has permission over a file named cache. I want to give permission to userB to remove the file. I have made following entry in /etc/sudoers file : userB ALL=(...
1
vote
1answer
234 views

Unable to delete a file using bash script

I'm having problems removing a file in a bash script. I saw the other post with the same problem but none of those solutions solved my problem. The bash script is an OP5 surveillance check and it ...
0
votes
2answers
504 views

Is it better to check if file exists before deleting it

Sometimes when I want to delete a file (from within a script), I will just delete it rather than checking if it exists first. So I do this: $ rm "temp.txt" 2>/dev/null Instead of this: [ -f "...
1
vote
1answer
217 views

Using Bash, how can i delete all the dektop.ini in my external drive folder tree?

I am using my external HDD to store my music, and now I've installed linux on my pc. I would like to erase all the desktop.ini files in the thousand nested folders on the HDD, how can I accomplish ...
0
votes
1answer
58 views

Recovering a file in Linux

I securely deleted a file in Linux by: 1) First encrypting it with AES (cipher block chaining) 2) Then using srm which does 38 passes (as explained in man srm) Any pointers on how to recover it?
0
votes
2answers
173 views

How to `rm` files in current directory and directories inside current directory

I would like to rm all files that end in ~ in both my current directory and all directories inside my current directory. I was under the impression that the flag -r or -R would do this; however, the ...
1
vote
1answer
841 views

Removing multiple files from directory, as specified by variable in Makefile

I have a Makefile with the following configured for installing man pages MANDIR = /usr/share/man/man1 MANPAGES = exec1.1 exec2.1 make install triggers the following: install: $(MANPAGES) ...
1
vote
2answers
489 views

unable to remove file and directory

i'm trying to remove directory from my external hard drive that i mounted to the file system i'm using the rm -r command but i got the the strange error : rm: cannot remove `Lundu nitip/Downloads/...
7
votes
1answer
5k views

Is there a scenario where rm -rf -no-preserve-root is needed?

I've seen some questions on here where people accidentally do rm -rf --no-preserve-root or rm -rf *, wiping out most or all of their file system before they can react. Is there ever a reason to use --...
2
votes
2answers
4k views

UNIX command for deleting / removing files on today's date

I want to remove all the files in the directory I am in currently in that were created today. So if today is April 3rd then the UNIX commond I am asking for would remove someFile2, someFile3, ...
0
votes
1answer
128 views

command to delete all files with numbers

How can I delete nay file that has a number in its name from directory /www/ and up? Like, it would delete a1.php a2.php 123213.php asdasd5.php Would this work? ls | grep \([1-9]\) -f | xargs rm ...