Questions tagged [rm]

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

Filter by
Sorted by
Tagged with
0 votes
2 answers
63 views

Remove all files with name starting with single quote

I need to delete all files with these names (the quotes are part of the name): 'index.html?some-query-string' I tried with: rm \'index.html?*\' I get this error: rm: cannot remove ''\''index.html?*'...
5 votes
2 answers
26k views

WinSCP - How to Zip, Download and Delete a file?

How is it possible to Zip, Download and Delete (ZDD) a file in WinSCP? For example, your local dir is Desktop and your remote dir (the one in your server machine) is, say, /var/www/html and you want ...
6 votes
2 answers
11k views

Need to delete a file I accidentally labeled in quotes in Linux [duplicate]

I have a file which I wrote and not thinking put the actual filename in single quotes like this: 'filename' When I try to remove it using rm -f 'filename' it does not recognize that it is there I get ...
0 votes
1 answer
225 views

sudo rm -rf permission denied

I accidentally copied my entire disk with rsync -a / ... to my backup server. When trying to delete this backup with sudo rm -rf backup_dir I get a permission denied error on some sub directories of ...
0 votes
0 answers
26 views

Why does "sudo rm -r /example/*" return "No such file or directory" when content exists? [duplicate]

I am using an Amazon Linux 2 distribution and trying to delete the contents of /opt/atlassian/jira/work directory using the following command sudo rm -r /opt/atlassian/jira/work/* The command returns:...
0 votes
1 answer
167 views

How to find and delete folders that are 15 days older using cron jobs in Truenas Scale?

I have security camera in my home it upload recorded videos to my Home NAS every one hour time intervals which is powered by Truenas Scale Operating System now all the footage are stored in my NAS I ...
0 votes
0 answers
43 views

How to skip an rm command without erroring out of the script [duplicate]

My SFTP script errors out if the target file in my "rm xxx" command doesn't exist. Sample script: OPEN sftp://pwd@host cd from_ar rm file1.edi -f rm file2.edi -f rm file3.edi -f rm file4....
2 votes
2 answers
5k views

rm -rf takes a long time

I have a directory ./aggregated/ in which I have 7550 sub-dirs each containing 250 files. aggregated has 5.5GB in total. I've tried deleting aggregated via rm -rf aggregated and it is taking hours. ...
7 votes
3 answers
6k 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 ...
1 vote
1 answer
511 views

How to remove file with hard link 0

I've tried to remove linux files from windows but they hadn't been deleted. I tried to remove from Ubuntu terminal but get "permission denied" I set chown $USER:$USER and chmod 777 for parent ...
0 votes
0 answers
148 views

Deleting folders using rm -rf does not free up space

I am trying to re-install macOS on my iMac. My iMac worked perfectly, before I upgraded macOS Ventura (It was a minor upgrade, I was already on Ventura). After I did a regular update, I logged into my ...
4 votes
2 answers
55k views

"rm: descend into directory" - what does it mean?

I am trying to follow instructions here to get emacs going but I am stuck with deleting the .emacs.d folder. What do I do when the command line asks: rm: descend into directory '.emacs.d'? a@b:~$ ...
-2 votes
2 answers
677 views

What does rm -R do?

First, googling for things like "-R", is useless. All kinds of unrelated answers come out. I know what rm -rf does, but what does rm -R does? (specially rm -R <directory>) (I actually ...
4 votes
3 answers
5k views

Undelete an "rm -r" on an exfat external hard disk device

There are several questions about how to undo an rm -r command, however in this specific case I have an exfat formatted partition / hard disk, rather than, for example, and ext4/ext3 formatted disk. ...
1 vote
2 answers
210 views

What happens to a file/directory after you remove it with rm -rf but is still open in VS Code or anorhet app?

This happens me a lot. I remove directory with rm -rf but see it is still open in an application such as VS Code. My concern is that does it cause some folders to be copied for VS Code to be still ...
16 votes
7 answers
73k views

Saying 'yes to all' using rm -i

Say I wanted to make sure I'm removing the right files first, so I did something like: rm -i * just to make sure that I'm okay with the files that I am removing. So this will ask me for each file. ...
46 votes
3 answers
88k 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 --...
3 votes
1 answer
677 views

I accidentally ran `rm -rf /*` on my wsl, what should i do

I accidentally ran rm -rf /* on my wsl (with root permission). and i rebooted and it became unusable. What should I do?
1 vote
1 answer
139 views

In a bash shell, is `rm -rf ./*` better/safer than `rm -rf *`

In a Linux bash shell, I saw someone typing rm -rf ./* because he wanted to remove every file and folder of the current folder. I wonder what is the benefit of typing ./* rather than * ? I think it is ...
10 votes
4 answers
4k views

Recover a file after shred command

Let's say I have some sensitive files in my computer and I want to completely delete them so that no one can ever retrieve them. For that, I can use the rm command, but it's still easily recoverable. ...
1 vote
1 answer
481 views

Unable to delete hidden files starting with "._", containing special characters

The file name is ._03 Überlin.mp3, and it lives in a folder on a Western Digital NAS external drive, being accessed on a Mac: $ ls -al total 128 drwxrwxr-x@ 1 kraftydevil staff 264 Jul 23 03:58 . ...
0 votes
2 answers
1k views

Stop deletion of files in Linux

I'm looking for a way to stop accidental deletion of some important files in Linux, but with a couple of criteria. The file has to remain writable (so it can of course still be replaced with rubbish ...
10 votes
2 answers
3k views

What if I do sudo rm -rf /mnt/c/* in my WSL?

Just for curiosity, what will happen after you run sudo rm -rf /mnt/c/* in WSL (Windows Subsystem for Linux)? Will it remove whole C drive in my computer? Will WSL keep working or not? If sudo rm -rf /...
1 vote
3 answers
2k views

remove a file with corrupted name

So this happened: $ ls ''$'\342\200''abc2.16.5' $ ls | od -c 0000000 342 200 a b c 2 . 1 6 . 5 \n $ ls -il 76236897 -rw-rw-r-- 1 mob users 0 Aug 16 17:52 ''$'\342\200''abc2.16.5' ...
1 vote
0 answers
288 views

UNremovable files/directory

opensuse leap 15.4 on asus l210 I have unreadable/unremovable files on a usb fs. Could someone kindly explain the following sequence of commands, and what I might do to get rid of the problem? /media/...
0 votes
1 answer
144 views

Cannot remove a symlink recursive

During a delete of a backup, somehow the rm -rf got stock and couldn't delete a symlink. Now, my folder looks like that: $ ls armips-master # folder $ cd armips-master $ ls armips $ readlink ./armips ...
0 votes
0 answers
153 views

I can't delete some files on my hard drive on ubuntu, says they don't exist, when they do

I use Ubuntu 20.04 and a folder containing some images was saved on my PC, but when I tried to delete it, I get this error. Same on terminal. I noticed that the folder now has a thumbnail with a ...
35 votes
3 answers
190k views

undo Linux's rm? [duplicate]

Possible Duplicate: UNDO LINUX Trash Command Hi, Is there any simple way to undo an rm command? The question is purely theoretical; I have NEVER deleted the log of a benchmark queue who took ...
67 votes
14 answers
189k 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
2 answers
761 views

Bash terminal rm permission denied on windows

I am currently learning how to use the bash hyper terminal on windows. All commands seem to work correctly e.g mkdir, touch, cd; but when trying to use rm to remove a file I get the message: "rm: ...
0 votes
1 answer
2k views

find + how to delete files that exists only on specific folder

to delete files on under folder we can use the following approach with find find /home -type f -delete but how to delete recursive only the files that exists under temp folder ? lets say we have the ...
0 votes
1 answer
178 views

How to remove ONLY files without directories via terminal (macOS)

Can you help me with deleting files on mac? I want to delete only files from the directory and save other folders there. rm and find -delete, but this is also deleting folders. Oh yes, folders in the ...
0 votes
1 answer
268 views

rm -f cannot delete a file

I downloaded a font from fonts.google.com. I unpacked it to ~/.fonts, the static dir was created. I moved its content one level up, to ~/.fonts. Now I can't delete the directory, because it contains ...
2 votes
1 answer
593 views

Which Linux shell command can completely remove a file from the system and make it unrecoverable?

Which Linux shell command can completely remove a file from the system and make it unrecoverable ? I have tied rm and shred but they have their limitations:- rm --help and see the information, you ...
2 votes
2 answers
1k views

Prevent accidental use of rm

I was going to clean up a directory filled with write protected directories, so I elevated to root, and instead of running rm -rf * / I ran rm -rf /*. You can guess what happened. Is there a way this ...
0 votes
1 answer
28 views

In Terminal, I can't remove Trashed Finder items deleted from other mounted volumes

The scenario is as follows. I run macOS A (APFS) which is an active partition. The macOS B&C (HFS+) are on mounted bootable volumes and visible while I'm working in macOS A. I can delete Finder ...
42 votes
5 answers
104k 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 ...
0 votes
0 answers
603 views

Can't Delete File With Single Quotes [duplicate]

I tried to compress a backup file via tar command on Linux (Oracle Enterprise Linux 8) but after the execution, i created a file named '--use-compress-program=pigz' by mistake. The problem is, i can't ...
-3 votes
1 answer
205 views

Kali linux-Wiped entire file system accidentally [duplicate]

Something pretty bad just happened I was testing some build files I had made as root, and tried to delete the contents of one of the directories the script had made, but I forgot to move to it and ...
0 votes
0 answers
320 views

Recover files deleted with rm under msys2

I was using a bash terminal under msys2. I have accidentally removed some user files with rm, under ~/MyDir. Do I have any higher chances of recovering them as compared to files removed with rm under ...
35 votes
3 answers
81k views

Mac -- remove all files with a certain extension from a directory tree [duplicate]

Possible Duplicate: Delete files recursively matching a name on the command line (OS X) I want to remove all files with extension .orig from my tree. The tree is deep. Is there an easy way to ...
1 vote
1 answer
2k views

Recovering deleted files deleted with Git Bash on Windows using rm -rf

While working in Git Bash on my Windows laptop, I accidently deleted important files and folders using rm -rf on C:>. Is there a way to restore them? Since the OS is Windows while tool is bash, ...
543 votes
14 answers
513k views

How do I make rm not give an error if a file doesn't exist?

I'm writing a makefile that will clean up some useless files at the end of the compilation. If a target has already been made, it will of course skip that target and the useless file may not be there....
0 votes
2 answers
82 views

Can I let `rm` prompt again if I type the wrong key?

Question Is there any way to let rm -i just ask again if I type in anything different than j/J/n/N at its prompt? Reason Consider this small example: echo "Hey, I am a file. Or at least I am IN ...
0 votes
2 answers
2k views

How can i delete all files and directories on a USB stick

I use the c shell. I wish to remove all the files and directories from a USB stick There are a lot of files and directories. Many of the files and directories start with a period (I.e. they are so-...
0 votes
1 answer
371 views

rm -rf no longer deletes folder in cron job

I wrote a program that writes a large number of small files to a temporary directory, then, via a call from within the program, deletes the temporary directory. This program is called via a user-...
1 vote
1 answer
3k views

How to revert rm -rf in Mac OS X?

I was trying to run a set of commands (all starting with rm -rf) to completely remove an application in Mac OS X. All my folders in Desktop are accidentally removed somehow. Is there a way to bring ...
2 votes
1 answer
305 views

Linux (Pop_OS) Deleted File Without Proper Permissions?

The other day I was doing some clean up and decided to delete a log file that I had stuck in my development environment, and when I did, I started to think the permissions should not have let me, I ...
7 votes
1 answer
16k views

Removing "rw-r--r-- root/wheel restricted" files in macOS leave some files left

I've just discovered a 4.5Gb /Previous System/private directory, caused by a (recent) upgrade to 10.13 (the dates seems to match). Since it weighs heavily on my available space and I don't know why ...
7 votes
5 answers
30k views

Cannot delete corrupted folder in windows 10

Today when I was trying to decompile .apk file using WinRAR, I got an error and unzipping terminated. After that when I am trying to delete the folder I am getting an error that I don't have ownership ...

1
2 3 4 5 6