Skip to main content

Questions tagged [rm]

Questions relating to the Linux remove command (rm)

Filter by
Sorted by
Tagged with
0 votes
1 answer
2k views

accidentally did `sudo rm -r /*`, can I fix it? [duplicate]

I accidentally did sudo rm -r /* from a directory. I don't know what got deleted. Now I can no longer login to my instance via ssh. Is there a way to recover the instance or creating new one is the ...
Rana's user avatar
  • 1
2 votes
1 answer
106 views

I followed a solution procedure on AskUbuntu, logged out and now all my data is gone (no guest account)

I did the following to get Skype to recognise my headset microphone (which was not working), as shown as a solution on a question on this website: rm -rf ~/.config/pulse/ Log out Log back in go to ...
Bea's user avatar
  • 95
0 votes
2 answers
51 views

I need help deleting my 20GB error log

My storage was being filled for an unknown reason, until I found by error log is 20GB+. When I tried to delete from disk usage analyzer, it gave me an error “Failed to move file to trash|Unable to ...
JkittenYT's user avatar
0 votes
1 answer
1k views

rm -rf .git removed all my folders including the parent folder?

I ran rm -rf .git because I wanted to delete the .git folder for this one small test project. and then do a git init again. See the attached screenshot with my command history. Today I realized my ...
theyeofbrows's user avatar
0 votes
2 answers
93 views

Show and delete Files in a folder from today

How can I use ll to display the files in a folder from today, eg. folder = /home/me/Downloads | today = 21.11.2023? How can I delete the result from 1. (displayed files) then using rm?
D-T's user avatar
  • 487
0 votes
2 answers
352 views

How to delete a file, ls -al got: "-????????? ? ? ? ? ?"

I try to download a model file from civitai.com by wget , and got a filename '201259?type=Model'. wget https://civitai.com/api/download/models/201259?type=Model&format=SafeTensor&size=pruned&...
SZ Hans's user avatar
1 vote
1 answer
7k views

rm: cannot remove *: Is a Directory

I installed "darling" and now want to delete it, but this shows up: rm: cannot remove 'darling': Is a directory When I ran rmdir it says: rmdir: failed to remove 'darling/': Directory not ...
user1740826's user avatar
1 vote
1 answer
283 views

Why can't both Windows and Ubuntu recognize a filename with special characters?

I was trying to append to a text file in bash in WSL (using the >> operator). Unfortunately since I'm a beginner instead of appending to a file, a new file was made with the >> 'text' as ...
KhodeNima's user avatar
  • 121
0 votes
1 answer
1k views

rm'd 300GB of storage in ubuntu but disk space hasn't been reclaimed

Due to a program I was running in ubuntu doing a number of unnecessary tasks (not immensely important but background) I had over 300GB of unwanted files on my local disk. I used the rm command on all ...
WinkingBanana's user avatar
0 votes
1 answer
245 views

Why am I getting errors in apt after I deleted and then re-created `/tmp`, `/var/tmp`, and `/var/log`?

Why am I getting an error after running the following commands? sudo rm -r /tmp sudo rm -r /var/tmp sudo rm -r /var/log sudo mkdir /tmp sudo mkdir /var/tmp sudo mkdir /var/log sudo apt update Error ...
Downvoter's user avatar
0 votes
0 answers
43 views

Accidentally removed /var folder then turned off

I did something even dumber than this post, which accidentally removed the /var folder. I then turned off the computer. Now, I can't turn back in. When booting, it stays blocked at /var/lib/snaps/...
bixiou's user avatar
  • 11
0 votes
0 answers
466 views

Ubuntu 22.04 after "rm /*" symlink /bin is gone, bash complain: /bin/bash: bad interpreter

Mistakenly ran rm /* as root. In result, it did remove all files from linux root dir, but preserved folders. (which is good news) lrwxrwxrwx 1 root root 7 Aug 5 2020 bin -> usr/bin ...
Lnuynxa's user avatar
0 votes
0 answers
746 views

I cannot rm -rf this directory Permission denied even though I have perm WSL2 ubuntu

So there is this location ~/.local/share/nvim/mason/.packages for mason to properly install packages it apparently needs to be able to remove stuff within this folder however my user doesn't have perm ...
Sombre Dreamer's user avatar
1 vote
1 answer
59 views

How can I delete non-mp3 files recursively using fish shell?

The tree list is like this: /Music |--- folder1 |--- folder2 |--- folder3 | |---- folder3.1 | |---- folder3.2 | \---- folder3.3 |--- folder4 I had tried the command rm | ls -R | grep -v &...
Leo_2233's user avatar
14 votes
2 answers
9k views

How do I repair Ubuntu after running the command: sudo rm /*

While I was trying to remove files from a SD card from the same directory, I ran sudo rm /* and now Ubuntu isn't working. When I restarted I get the error: kernel panic attempted to kill init. I'm new ...
Jag Mohan Ray's user avatar
0 votes
1 answer
3k views

Is it possible to recover a deleted directory? [duplicate]

I deleted a directory using the command rm -drf file_dev as root. Is it possible to recover this directory with its content somehow?
sarp's user avatar
  • 433
2 votes
1 answer
6k views

Anyway to undo overwriting file by mv or recover replaced file?

I accidentally mv a new file to an existing file and overwrote it. Is there anyway to undo mv or recover the replaced file?
user42's user avatar
  • 21
0 votes
0 answers
502 views

How do you figure out what rm -rf deleted

I've accidentally executed rm -rf ~ because I failed to autocomplete a directory and it stayed with my home directory. I was quick enough to kill the command in time, so no real damage (I think) was ...
Joliver's user avatar
  • 101
0 votes
1 answer
120 views

Cannot delete or restore files from Trash

When I try to delete a file from Trash I get the message Error while deleting There was an error getting information about "file.txt". Timeout was reached If I remove the file using the rm ...
redfords's user avatar
1 vote
2 answers
2k views

Cannot delete directories as sudo: Permission Denied

I am trying to remove directories with files and getting a permission denied error on Ubuntu 22.04.1. I've changed permissions to 777 for the directory and the parent directory but I still get the ...
Artillery's user avatar
  • 356
1 vote
2 answers
417 views

How to delete directory/file named "-f", "-r" or other in terminal [duplicate]

Just wondering how to delete directory/file named "-f", "-r" or other using terminal.
Vitalii's user avatar
  • 19
2 votes
1 answer
2k views

Home folder contents lost: wrong use of rm?

I am using Ubuntu-Mate 20.04 and I have lost most of the contents of my home folder. I think it could be due to using wrongly the “rm” command with sudo, but not sure if it might be something else. I ...
ubuntu_user2340's user avatar
0 votes
1 answer
223 views

How do I get rid of these files?

I installed a program, decided I don't want to use it anymore so I got rid of it with: sudo apt purge "target_program" The program got uninstalled but left behind some leftover files and ...
Uncle Woods's user avatar
0 votes
1 answer
52 views

How to change script for deleting files while names misses symbols?

I am trying remove files by names according this answer How to delete files listed in a text file But get following error: rm: cannot remove 'var/Resources/Images/fd29d33d.jpg'$'\r': No such file or ...
Mateech's user avatar
  • 131
0 votes
1 answer
611 views

How to remove files in a directory with lots of subdirectories quickly?

I have a directory like this: my-app/ ├─ 1/ ├─ 2/ ├─ .... (a lot of subdirectories) ├─ N/ In each subdirectory, there are a LOT of PNG files, like: 1 ├─ 1.png ├─ 2.png ├─ .... ├─ 100000000.png (not ...
AGamePlayer's user avatar
0 votes
1 answer
177 views

Undeletable "Icon" file

I have a strange problem with some files on my NAS that are not deletable, maybe remnants of some MacOS file copy. They appear with filename "Icon" in file manager but as 'Icon'$'\r' with ls....
lucaspeed's user avatar
0 votes
0 answers
69 views

Keep bigger size image file and delete image files with smaller sizes of same name, using terminal command

Keep bigger size image file and delete image files with smaller sizes of same name, using terminal command My directory may contain a_500.jpg, a_1280.jpg BUT b_500.jpg, c_500.jpg, c_800.jpg. So, in ...
Estatistics's user avatar
3 votes
4 answers
4k views

What happens if we do rm -rf ../**? Can we restore the data?

I did something like: $ cd /A/B/ $ rm -rf ./* $ rm -rf ../** Due to network issues my system disconnected from Ubuntu. When I came back there were no files or folders in the /A folder.
xxz's user avatar
  • 39
0 votes
2 answers
58 views

How to delete a list of filenames without path that are matched in multiple subdirectories?

How to delete a list of filenames without path that are matched in multiple subdirectories? Delete_list.txt may contain (each filename is per line): a.jpg b.jpg c.jpg These files may exists in ...
Estatistics's user avatar
0 votes
1 answer
1k views

Not able to to delete file with drwx--S--- permission

We are not able to delete file because of special permission drwx--S---. I have tried command chmod g -s filenameion but we cant use root user. SO is there anyway to delete
maya patil's user avatar
0 votes
1 answer
33 views

Entire system starts malfunctioning after empyting bin

So recently I wiped the trash bin folder with the sudo rm /bin command because it was getting filled up with a lot of junk that I didn't put there. Now I can't boot and get error messages. I don't get ...
apchrkey's user avatar
0 votes
1 answer
2k views

Why I can not remove neither folder nor its content?

Here is the folder and its content.I don't understand why I cannot remove these files and this folder. ls -ltr results in: total 16672704 -rwxrwxrwx 0 17064381527 Eyl 2 18:10 101737-31-HO-...
Baran Aldemir's user avatar
-1 votes
2 answers
486 views

In short i accidentally typed sudo rm /* and now my system doesnt boot as something is deleted in / [duplicate]

I am a beginner and hence did a child's mistake and now i cant enter my system and when I try to enter recovery shell it says "Kernel panic - not syncing attempted to kill init?" and i didn'...
Shreyas Devesh's user avatar
0 votes
0 answers
1k views

How to delete this WindowsApps folder (permission denied with rm even with sudo :( )?

I used to use windows on my laptop and then moved ubuntu. While I was using windows, I once moved microsoft store apps to a different partition to save space in C drive and I guess it was saved in &...
Jarif Rahman's user avatar
1 vote
1 answer
635 views

How to delete a file named -something with rm [duplicate]

When I have a file named -19-5-20674., how can I delete that file? When I use sudo rm: $ sudo rm -19-5-20674. rm: invalid option -- '1' Try 'rm --help' for more information. What can I do?
Msk Dev's user avatar
  • 11
6 votes
2 answers
5k views

Protect folder from accidental deletion with `rm`

I have some folder ~/foo which I'd like to protect from accidental deletion, that is I'd like to protect it from deleting with rm -r ~/foo or rmdir ~/foo. I realized you can do that using chmod a-w ~/...
flawr's user avatar
  • 409
0 votes
2 answers
478 views

Safely remove directory with unknown contents

I have a directory /usr/local/foo, which I need to remove. This is going to be part of a script, which needs to be run as root. I'm mainly worried that the directory, which contains things that users ...
Michael's user avatar
  • 65
0 votes
1 answer
5k views

Accidentally deleted home directory on Linux, how to recover?

I accidentally deleted my home directly from terminal with rm -rf. Later, I tried to recover the deleted contents using foremost and testdisk. I couldn't recover the content and there were some ...
Vikram's user avatar
  • 1
-2 votes
1 answer
13k views

rm: cannot remove 'test123': Permission denied [closed]

I use this command but it didn't work rm test123 note 1 : menna@ubuntu:/etc$ l -ltr total 1116 drwxr-xr-x 7 root root 4096 Mar 18 06:11 apparmor.d/ drwxr-xr-x 3 root root 4096 Mar 18 06:11 ...
Menna Shaaban's user avatar
-5 votes
1 answer
717 views

how to write a command to remove a folder, name includes spaces.? [duplicate]

How can I delete a folder with whitespace in its name, but without quoting the folder name? I also need to be prompted to confirm the deletion. I know how to do it like this: rm -ri /home/user/'my ...
Jay B's user avatar
  • 23
0 votes
1 answer
270 views

find command to search for logs

I need to search logs only in a, b ,c, d, e, f directories and not in the subdirectories The command I use: find . -name "*.log" | xargs rm which deletes important logs inside these ...
Chandra Sekar K's user avatar
4 votes
0 answers
2k views

Recovering deleted files with rm -rf [duplicate]

I accidentally deleted a directory with rm -rf /media/directory When using ls -lh /media the space appears to be free, but when I use df or open the file manager nautilus or pantheon, it shows that ...
kqvanity's user avatar
  • 117
1 vote
0 answers
917 views

Trying to use extundelete for recovering a "rm -rf"ed directory. But receiving this: extundelete: No such file or directory /dev/sda5

so I accidentally deleted a dirrectory using "rm -rf". I am trying to recover is using extundelete. So far I have done these: $ sudo umount -l /dev/sda5 $ extundelete --restore-directory {...
pigwidgeon's user avatar
0 votes
1 answer
151 views

Move all files with a certain extension from different subdirectories

Is there any Linux command to move all files with a certain extension (let's say .txt) from all different subdirectory (which has subsubdirectories, subsubsubdirectories...) to another directory?
SNU's user avatar
  • 1
0 votes
1 answer
1k views

What will the following command delete? rm -r * /mnt/folder

I just want to make sure: rm -r * /mnt/folder1 This deletes folder1 and all files and folders in the directory that I am actually in?
AlexOnLinux's user avatar
-3 votes
1 answer
216 views

Understanding the windows equivalent of braces [closed]

I am following a manual written for ubuntu, however I am in a windows environment. I understand the rm -rfv, but I have no idea what the braces do in the line below, I want to run the equivalent in ...
Mark Fowler's user avatar
0 votes
0 answers
3k views

rm no such file or directory terminal

I have tried --force, it doesn't work. When I put in sudo rm -d /someplace/wanttodelete it says: rm: cannot remove '/someplace/wanttodelete': No such file or directory There is a directory, I can cd ...
Aurora Dizon's user avatar
0 votes
1 answer
145 views

Repair root following "rm -r ~" error

I was running a terminal as root and following installing a package noticed I had created a new directory in error. I used rm -r and began typing the directory when my cat jumped up onto my desk. I ...
Will-ko's user avatar
0 votes
1 answer
490 views

Cannot remove "empty directories" from my external hard drive after rsync fail

It seems like I have 4 empty directories on my external hard drive (NTFS). But I can't remove them with nautilus or a terminal. I think this happened just after my attempt to synchronize 2 directories ...
Zatigem's user avatar
  • 488
6 votes
2 answers
2k views

Accidentally copied files to wrong directory

Years ago I copied all the files from /usr/local/bin into /bin. Now my /bin directory is littered with unneeded files. How do I remove them using the find command without having to install third party ...
WinEunuuchs2Unix's user avatar

1
2 3 4 5 6