Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [rm]

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

Filter by
Sorted by
Tagged with
1 vote
1 answer
26 views

How to delete the file with unusual characters in the name

On MacOS I have this file in the Trash: $ ls РЎРЅРёРјРѕРє СЌкрана 2013-03-21 РІ 10.38.49.png I'm unable to delete that file in any way. Things like rm or find (even with inum) do not work, ...
takeshin's user avatar
  • 2,123
0 votes
2 answers
173 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?*'...
Giacomo M's user avatar
  • 133
0 votes
1 answer
351 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 ...
Meinrad's user avatar
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:...
Richard's user avatar
0 votes
1 answer
250 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 ...
user avatar
0 votes
0 answers
44 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....
JSS's user avatar
  • 1
0 votes
0 answers
171 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 ...
אורי orihpt's user avatar
-2 votes
2 answers
1k 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 ...
KansaiRobot's user avatar
1 vote
2 answers
232 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 ...
yokus's user avatar
  • 45
3 votes
1 answer
825 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?
monstar's user avatar
  • 133
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. ...
Vincent's user avatar
  • 121
1 vote
1 answer
146 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 ...
souch's user avatar
  • 113
1 vote
0 answers
313 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/...
user985675's user avatar
0 votes
1 answer
157 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 ...
Sisyffe's user avatar
  • 11
0 votes
0 answers
157 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 ...
James Regan's user avatar
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 /...
monstar's user avatar
  • 133
0 votes
2 answers
804 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: ...
Mike Piedra's user avatar
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 ...
King David's user avatar
0 votes
1 answer
204 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 ...
Art's user avatar
  • 101
0 votes
1 answer
287 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 ...
peter.slizik's user avatar
2 votes
1 answer
667 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 ...
Adarsh Goyal's user avatar
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 ...
Paul Bergström's user avatar
0 votes
1 answer
33 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 ...
Elijah's user avatar
  • 1
0 votes
0 answers
635 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 ...
postgresnewbie's user avatar
-3 votes
1 answer
214 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 ...
Gamaray's user avatar
0 votes
0 answers
337 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 ...
sancho.s ReinstateMonicaCellio's user avatar
1 vote
1 answer
3k 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, ...
Prasad's user avatar
  • 11
0 votes
2 answers
87 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 ...
Bowi's user avatar
  • 1,487
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-...
operauser's user avatar
0 votes
1 answer
388 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-...
stillQuestioning's user avatar
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 ...
Mehmed's user avatar
  • 121
2 votes
1 answer
314 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 ...
codenoob's user avatar
  • 129
0 votes
1 answer
581 views

How to delete a hard link in a directory without write permissions?

I'm configuring a snapshot daily backup based on this recipe: http://www.mikerubel.org/computers/rsync_snapshots/ To summarize, on the backup server I rotate the older copies by running: dir=...
user1079505's user avatar
1 vote
1 answer
2k views

How to remove the /snap directory?

I want to remove the snap directory: sudo rm -rfv /snap rm: cannot remove '/snap/*': Read-only file system Remount it as read and write. df /snap Filesystem 1K-blocks Used Available Use% ...
showkey's user avatar
  • 161
0 votes
2 answers
725 views

How to recover a deleted text file that is still open in vim?

I have text file that is still open in vim, but the original text file has been accidentally deleted. How can I recover it? The text file is still open in vim, so its original data is still stored in ...
Amir reza Riahi's user avatar
0 votes
0 answers
48 views

Cannot delete temporary file with extremely long name

I ran BleachBit for Linux on an external hard drive with the wipe-free-space function (empty space is overwritten with zeros) and for some reason the program crashed mid-course. It left over a ...
david's user avatar
  • 337
0 votes
1 answer
605 views

Exclamation Points - Is there a linux bash command to find and delete all directories named "!example" (and their contents)

I have searched and searched for an answer to this question, and I have used some of the answers I found in the past for finding and deleting large numbers of directories that are named by a certain ...
Brad's user avatar
  • 1
1 vote
1 answer
177 views

Is there any way to enable a backup of the current directory to take place when an rm command is issued?

I know how dangerous rm can be, and I'm unfortunately not a very responsible person at all. I know that I need to learn, but while I'm in the process, I need some help. Is there any way to create a ...
MetricSystemAdvocate's user avatar
1 vote
1 answer
495 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 . ...
kraftydevil's user avatar
0 votes
0 answers
2k views

Operation not permitted

I am trying to delete files from trash on my MacBook. I have tried to remove with: sudo rm -rf /.Trash ~/.Trash Can not remove all files from Trash in OS X But I get Operation not permitted error ...
NathanGL's user avatar
  • 101
0 votes
1 answer
4k views

How to delete locked app on MacOS (Catalina)

I'm trying to delete a locked app on Catalina. In recovery mode, I disabled SIP, restarted and gave Terminal Full Disk Access. Tried this: /Volumes/Macintosh\ HD/Applications/Crashplan.app: ...
RS001's user avatar
  • 1
1 vote
1 answer
2k views

Can't delete, chown or chmod file even as root

I want to delete a backup of a website (FTP-mirrored with wget), but a single file, named js_composer.less resists. I can create new files and delete them in the same directory, so the problem might ...
Márton Tamás's user avatar
2 votes
2 answers
6k 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. ...
s5s's user avatar
  • 141
1 vote
1 answer
543 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 ...
Valery's user avatar
  • 111
1 vote
1 answer
1k views

How to delete a large number of temporary files on my external hard drive?

I'm currently processing a series of large data files (150+ GB) on my home laptop (a 2015 MacBook running MacOS Catalina 10.15.3). I ran into the issue where a particular program wouldn't finish ...
jman1234's user avatar
0 votes
0 answers
237 views

Deleting Files and directories on a Solid State Drive (fdisk, dd, rm)

I have been reading for a while on how rm, fdisk and dd work. I wasn't able to fully understand their source code however. Let's assume I would like to delete my /dev/nvme0n1p3 partition and the files ...
user171558's user avatar
0 votes
1 answer
362 views

I accidentally ran `rm -rf /` what should I do

I accidentally ran rm -rf / on my macos machine, most files were protected since I was not running the command as root, but I definitely lost some files in /usr/local, are there any other files I ...
Alexander Mills's user avatar
3 votes
2 answers
7k views

Bash Script to delete oldest files but keep latest files including sub-directories

I'm trying to delete old files but should keep latest 3 days log files.i tried below command, ls -tr /home/httpd/htdocs/pathname/pathname/config//build/logs/apps/.log | tail -n +4 | xargs rm -- but ...
Sudesh Lakmal Pathirana's user avatar
1 vote
2 answers
754 views

Deletion behavior of rm *

If I execute rm * within a directory containing files, are only files in this directory deleted? Or does the asterisk include the filesystem root / as well?
2080's user avatar
  • 205
3 votes
2 answers
8k views

How to delete a directory in MacOS from the command line?

I would like to know how to delete a directory on my MacBook. I have tried several methods such as moving it to the Trash -> Empty Trash, via the command sudo rm -rf, restarting the computer in ...
ipegasus's user avatar

1
2 3 4 5 6