Questions tagged [rm]
Questions relating to the Linux remove command (rm)
40
questions with no upvoted or accepted answers
6
votes
0
answers
1k
views
Why did an rm command executed from a pwd NOT / remove directories from it?
OK, so I've been doing different levels of sysadmin for almost a decade and yet I fell victim to an age old mistake; though I do not understand why it happened.
I was in my server sorting through ...
4
votes
2
answers
2k
views
How to prevent users from deleting files that are already in use?
Consider this scenario:
User is executing a command on a file. This file becomes 'in-use' now.
$ tail -f somefile.log
In another shell, user deletes the file.
$ rm somefile.log
Now, this file is '...
2
votes
0
answers
862
views
When is it safe to delete the contents of /tmp and /var/tmp?
I'm trying to make a locked down, auto-restoring system that will restore itself once every week. I'm wondering if /tmp and /var/tmp can be safely removed if the system is booted on a different ...
2
votes
0
answers
59
views
rm -r /media/externalHD --> can't boot without external HD anymore
My external HD was mounted in /media/user/TRANSFER.
By mistake I typed
sudo rm -r /media/theo/TRANSFER
There was an error because the device was occupied and fortunately, I haven't lost my data.
...
2
votes
0
answers
2k
views
File appears in ls, but cannot be moved, opened, or deleted
I have a few files in a certain directory that appear in ls, but any attempts to delete, move, or open them direction (via terminal or GUI) are met with a "No such file or directory" error.
Trying ...
2
votes
0
answers
2k
views
Cannot remove the file - "No such file or directory"
Yesterday I found this file in my git repo and I can't get rid of it no matter how hard I try.
The file is located on a NTFS disk.
sebastian@protean /media/sebastian/DATA/04 - PROJECTS/02 - MANAGER/...
2
votes
0
answers
1k
views
How to remove the config file of eclipse(default)
In my Ubuntu 16.04, I installed eclipse. But Java perspective is not working. I have installed open-jdk but Java perspective is not coming up. When I tried they are getting the java perspective by ...
2
votes
1
answer
1k
views
Aliased rm, how do I also alias sudo rm
I aliased rm to a echo use del or full path to rm to save myself from accidental rm (just lost my $HOME to it).
But sudo rm still uses /bin/rm. How can I alias it to also print same message?
PS: del ...
1
vote
0
answers
829
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 {...
1
vote
0
answers
127
views
Order of File Deletion in Bash
I'm surprised that I was not able to find this question posted already, but is there an definitive order in which files are deleted when using rm -r? For context, I accidentally began deleting a large ...
1
vote
0
answers
345
views
how to automatically delete the folders of more than one day in the crontab
I would like to delete all of the directories that are more than one day old, knowing that these directories can be empty or not. this command must be executed from the crontab every day.
I tried ...
1
vote
2
answers
2k
views
Started to delete /usr/share by mistake: what to do now?
In Ubuntu 16.04, I ran by mistake sudo rm -rf /usr/share. I know how stupid that is (I wanted to remove /usr/share/somefolder that had been installed as root and got distracted). I interrupted it ...
1
vote
0
answers
775
views
How to trigger a terminal command when incorrect password entered...?
I am trying to make a line of secure operating systems with Ubuntu as the base OS, and I want to have an automated function that will erase the disk if certain triggers are met. Here is what I need (...
1
vote
0
answers
551
views
Delete Folder containing script itself
Let's assume we have a folder /home/user/testfolder, and this folder contains several files, including an uninstall script. This script is supposed to delete /home/user/testfolder and all its content ...
1
vote
0
answers
112
views
How can i remove home directory from download directory without deleting it
In my Downloads folder when I make ls I see the home directory, and I don't know why, I want to remove it but I am afraid to remove my home folder.
Can anyone tell me how I can just remove the home ...
1
vote
0
answers
90
views
How to recover user data missing after reset of computer
I was trying to figure out how watch 4oD (as like many people it just loads forever and never actually plays anything) so I used the help on this page: 4oD (UK) - Can't stream
I started with this:...
0
votes
2
answers
43
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 ...
0
votes
0
answers
37
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/...
0
votes
0
answers
386
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
...
0
votes
0
answers
500
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 ...
0
votes
0
answers
414
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 ...
0
votes
1
answer
101
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 ...
0
votes
1
answer
144
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....
0
votes
0
answers
62
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 ...
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-...
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 &...
0
votes
0
answers
2k
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 ...
0
votes
0
answers
4k
views
Cannot remove read only file system
I have some videos recorded using gopro. The videos are in the SD card. Now i want to delete them. But rm gives me this command. How do I delete them?
rm: cannot remove 'GOPR0002.JPG': Read-only file ...
0
votes
1
answer
377
views
Bash delete file with two variable path not working
I have a bash script containing this code:
path=/apps/files/
ext=*.csv
rm -f $path$ext
This is not working. When I set -o to echo each command I see this in the output...
rm -f '*.csv'
So it's ...
0
votes
0
answers
194
views
Automate Deletion of File from terminal
I want to write a Python script that will automate my commands without waiting for user input.
My python script will delete the least played video. When I execute the command:
rm video_123.mp4
it ...
0
votes
1
answer
26
views
RM on an LUKS installation?
I am just wondering what will happen if you do sudo rm -rf / --no-preserve-root on an LUKS installation... Will the LUKS information be corrupted, rendering it useless (impossible to recover files) or ...
0
votes
0
answers
39
views
How to make the system display an image after RM on root?
Is there possibly a way to cause the system to display an image (from another partition, so that the image isn't deleted upon sudo rm -rf / --no-preserve-root) when the operating system can't be found?...
0
votes
0
answers
936
views
How do I use logrotate to remove old log tarballs?
I'm using Ubuntu 14.04. I want to rotate log files daily, including deleting old tarballs. I edited my logrotate.conf file, /etc/logrotate.conf, like so
/home/rails/myproject/log {
daily
...
0
votes
0
answers
33
views
Two direcories.. Two capacities.. One drive.. How to fix this?
This is my predicament You see here one drive (the Intel SSD shown on disks app) which is labeled as /device/sdb
yet some how an other drive (WD HDD) labeled as /device/sdc link to the same directory ...
0
votes
1
answer
91
views
Does anyone have some suggestions for me I deleted some important files
Is there a way to recover removed files in a situation such as described below? The command I executed was:
root@system:/# rm -r /tmp/letsencrypt.sh-XXXXXX l*
I tried to remove all the files in ...
0
votes
1
answer
1k
views
Deleted 16GB MySQL log file, no space freed
I deleted a 16GB MYSQL log file via the command line:
sudo rm /var/log/mysql/slow.log
but the space has not been freed. Is there some sort of flush I need to run?
0
votes
4
answers
3k
views
Home deleted by rm command, cannot login
I tried to use rm to format a pendrive but it also deleted everything inside my Home folder.
Now I can't even login anymore. Also, pressing shift on boot wont enter in recovery mode.
I have the ...
0
votes
1
answer
127
views
How do I determine what is using the folder?
I just can't delete the folder under root (it says that resource/device is busy), but lsof and fuser tell me nothing. The folder is located in the depth of /var/www/... and I tried to delete it after ...
0
votes
1
answer
415
views
How can I remove this file?
I'm using an Apple Timecapsule mounted via gvfs-mount (I tried cifs too) which contains a file named
Capitoli 3:5.odt
I definitely want to remove that but I had no luck.
From ubuntu the most i ...
0
votes
1
answer
106
views
Crontab entry not running as expected
I have setup crontab e with the following line and it is not running every hour on the 14th minute as I expect it should.
14 * * * * rm -rf ~/.local/share/Trash/*
First, is this code correct?
...