Questions tagged [rm]

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

Filter by
Sorted by
Tagged with
-2 votes
2 answers
38 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
40 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
2 votes
1 answer
159 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
  • 113
10 votes
4 answers
3k 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
  • 111
1 vote
1 answer
79 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
  • 13
1 vote
0 answers
99 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
35 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
109 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
9 votes
2 answers
2k 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
  • 113
0 votes
2 answers
452 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
0 answers
105 views

Some idiot ran `sudo rm -rf /*` to factory reset a Kemp LoadMaster. How do I restore?

So I recently bought a Kemp LoadMaster. The seller was an idiot and "Factory reset" The machine. But to reset the machine, he/she logged in and ran sudo rm -rm /*. So when I get the machine, ...
Hardwaregore's user avatar
0 votes
1 answer
75 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
95 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
1 vote
1 answer
241 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
1 vote
2 answers
458 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
12 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
339 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
124 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
220 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
1k 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
68 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,375
0 votes
2 answers
835 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
259 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
2k 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
235 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
331 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
1k 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
  • 159
0 votes
2 answers
443 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
42 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
  • 287
0 votes
1 answer
377 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
78 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
311 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
992 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
3k 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
1k 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
1 vote
2 answers
3k views

rm -rf foo_dir 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
  • 121
0 votes
0 answers
362 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
  • 101
1 vote
1 answer
909 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
105 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
308 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
5k 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
235 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
6k 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 vote
0 answers
3k views

Can't delete the file with rm command

I have a file which can't deleted by rm. /var/www/html/symfony4proj/var/cache/pool/+m7exph6c3/X/3/tCcgRMw5TEmYO-kHpJ0t file satus -rw-r--r-- 1 app app 2781 Jan 1 1970 tCcgRMw5TEmYO-kHpJ0t Change ...
whitebear's user avatar
  • 615
0 votes
1 answer
75 views

Why this hard-to-understand 'find' command broke my system?

I am using archlinux and I was trying to delete core dumps file to save space on the root partition. I stupidly ran this which I found in internet without really understanding it: sudo find / -xdev -...
Rashad's user avatar
  • 13
7 votes
5 answers
29k 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 ...
Mandar Sadye's user avatar
7 votes
1 answer
14k 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 ...
tiennou's user avatar
  • 248
1 vote
1 answer
2k views

Why does rm over NFS not free space immediately?

I'm on a SUSE Enterprise server which has mounted a drive via an NFS mount. I have created a 34GB file via dd if=/dev/Zero of=test_file bs=8k Count=4194304 to test the write speed of the NFS share. ...
Robert's user avatar
  • 139
1 vote
3 answers
1k 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' ...
mob's user avatar
  • 262

1
2 3 4 5 6