Questions relating to the Linux remove command (rm)

learn more… | top users | synonyms

0
votes
0answers
19 views

How to prevent execution of “sudo rm -rf --no-preserve-root / ” command?

After going through this question I'm quiet scared !!! Its not that I don't want to use sudo rm command. But I want to inhibit the execution of sudo rm -rf --no-preserve-root / command. If this ...
3
votes
4answers
167 views

Unable to delete directory

I made a directory , the name is "shadi" and I set this permission for it In this situation I have others permissions but why I can not delete the
3
votes
2answers
345 views

Difference between rm executable >>dev/null and rm executable

What is the difference between rm executable and rm executable >>dev/null I had the later statement in a Makefile and changed it to the first one. I had the impression that nothing changed....
0
votes
1answer
66 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 ...
179
votes
6answers
214k views

How can I recursively delete all files of a specific extension in the current directory?

How do I safely delete all files with a specific extension (e.g. .bak) from current directory and all subfolders using one command-line? Simply, I'm afraid to use rm since I used it wrong once and now ...
0
votes
1answer
1k views

Duplicate /media directory entries

I installed Ubuntu 64-bit 12.04 over Ubuntu 32-bit 32-bit on the same partitions. In my /media directory I have what appear to be duplicate entries. I had found a similar issue on an Ubuntu discussion ...
3
votes
3answers
59 views

how do i make shell ask for confimation for rm -rf command (even sudo)?

I want to make the command shell to prompt me for confirmation before execution of certain commands like dd , rm -rf etc.
0
votes
0answers
15 views

Removing the folder $Windows.BT

In my dual-boot system I have Windows 8.1 installed (next to Ubuntu 14.04.1). Now I want to remove the folder $Windows.BT in my Windows system (due to being too large, and I do not want to update to ...
0
votes
1answer
28 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
1answer
64 views

Accidentally deleted EVERYTHING in /usr/local

I performed sudo rm -rf newfolder, when I was in /usr/local/ directory. It has deleted everything inside that folder! I only wanted to delete newfolder inside that directory. How can I restore what ...
16
votes
6answers
11k views

Is there any faster way to remove a directory than “rm -rf”?

I have a folder that has many files and "rm -rf" takes a lot of time to complete. Is there any faster way to remove a directory and it's contents (subdirs, etc)?
8
votes
2answers
2k views

I have a file named “-t”. How to remove it? [duplicate]

Output of "ls -l": -rw-r--r-- 1 root root 0 Mar 4 08:22 -t When i try to do "rm '-t'": rm: invalid option -- 't' Try 'rm ./-t' to remove the file '-t'. Try 'rm --help' for more information.
1
vote
3answers
87 views

Can't delete a file with a '?' in the file name

Can't delete a file with a '?' in the file name, it fails to delete with the message 'the file does not exist'. I've tried through the terminal using rm -f ./pathtofile\?.mkv But despite no ...
2
votes
4answers
2k views

how to remove files in a list of paths easily?

I have a list of lines like /usr/lib/i386-linux-gnu/libavfilter.so /usr/lib/i386-linux-gnu/libavfilter.so.3 /usr/lib/i386-linux-gnu/libavfilter.so.3.42.103 /usr/lib/i386-linux-gnu/i686/cmov/...
35
votes
5answers
276k views

How do I remove a folder?

I'm a new user and Im trying to remove a specific folder. I am using sudo rm /path/ but its not working. What is the correct command to use? It is a file catolog I am attempting to remove but im ...
9
votes
4answers
14k views

How can I make rm stop asking me for permission?

On my server rm always asks me for permission (even though I'm root) when I run it, on my desktop it does not. Like so: $ rm mod_wsgi-3.3.tar.gz rm: remove regular file `mod_wsgi-3.3.tar.gz'? How ...
35
votes
5answers
66k views

Can files/directories deleted with rm be restored?

Is it possible to restore files/directories which are deleted from terminal using rm and rm -r?. If a file is deleted from graphical interface, it could be restored from trash, but how do you restore ...
1
vote
0answers
47 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 ...
3
votes
2answers
7k views

how to download “rtsp” flow

I could download a conference from this link (rtsp://real2.infn.it/webcast/2012-esploratori-invisibile/esploratori-dell-invisibile.rm). How can I do it? Thank you previuosly..
3
votes
1answer
475 views

How do I delete / remove a file

I am a beginner with Linux / Ubuntu, and I'm trying to remove / delete a file. The specific is a wallet I created in Electrum to import a paper wallet; I can see the wallet in the file list but can't ...
1
vote
1answer
75 views

Given rm why does rmdir exist?

Is there any resultant difference on disk between using rm or rmdir to remove a directory? Or is it only different by usage preference, By example, given $ mkdir a $ mkdir a/b $ mkdir a/b/c ...
68
votes
9answers
306k views

How to remove all files from a directory?

The closest I've gotten is # rm /path/to/directory/*.* but that doesn't work for files that don't have an extension...
0
votes
1answer
774 views

How do I remove a MATLAB program running on Ubuntu 14.04

I have installed MATLAB 2012 on Ubuntu 14.04, and I want to uninstall it. According to the support instructions, I should type in a command as rm -rf matlabroot. Howeever, this does not help. In fact, ...
4
votes
0answers
126 views

Not allowed to delete a encfs-encrypted empty folder

I have an encfs-encrypted folder and just cut the content of a subfolder of it and pasted it into another folder outside the encfs-encrypted one. While doing that, I got an error message, saying that ...
1
vote
1answer
56 views

dpkg is confused since I manually removed installation files for spotify with sudo rm recursive

So I was reading to learn on how packages and package installation works in Ubuntu in general and where do the files responsible for the existence of any application (installation files) reside in my ...
0
votes
0answers
66 views

script bash to move file with multiple extension

#!/bin/bash # #Directory MOVETO=/DRIVE/new2/ SOURCE=/DRIVE/picture/ #files to find MOVEFILES=("*.m4v" "*.avi" "*.art" "*.3gp" "*.mpeg") find "$SOURCE" -iname "${MOVEFILES}" -type f -exec mv -v -...
1
vote
2answers
90 views

Can rm -rf use grep?

I am trying to use PlayOnLinux to install iTunes but my wine is clogged up, so I want to 100% delete the wine files, so is there any way to delete all files with the tag (or word) wine in them? ...
1
vote
1answer
38 views

How to delete all files that contains “ (2)” wildcards dont work

I would like to delete all files that contains " (2)" --whitout the quotes-- in the file names. I tried first with ls to test ls *(2)* and list all the files in the folder ls "*(2)*" don't ...
2
votes
4answers
3k views

How to delete all the files/folders from the folder except few folders?

Assume that I have a directory structure as follows: application │ ├── config │ ├── c1.conf │ └── c2.conf │ ├── logs │ ├── l1.txt │ └── l2.txt │ └── src ├── static ├── s1.py └── ...
0
votes
1answer
2k views

Restore Direcory/files after rm -rf

I've accidentally deleted a project directory from my Ubuntu with rm -rf. is it possible to restore them somehow?
2
votes
1answer
103 views

Remove except some files/directories in a script; need revision

I have the same problem as this question How to delete all the files/folders from the folder except few folders? several times. This is the reason why I wanted to write myself a script for a command ...
0
votes
1answer
111 views

trash: cannot trash regular file

I'm trying to avoid using rm so I don't delete anything permanently. I'm using the utility function trash, but it keeps telling me trash: cannot trash regular file. Why can't I delete these files? ...
-1
votes
4answers
608 views

How to remove a file from usr/share/applications on ubuntu 14.04

I have examined this page (How to remove single file from /usr directory?) and tried sudo rm /usr/share/applications/Eclipse Mars C/C++.desktop in the terminal, but it didn't work. I think the ...
0
votes
1answer
243 views

“rm: not found” by apt, cron and others

For some reason I get this error all the time in system scripts: rm: not found For example I wanted to update the system: Setting up install-info (5.2.0.dfsg.1-6) ... /usr/sbin/update-info-dir: 52:...
0
votes
0answers
17 views

Millions of files automatically created inside home/rPns20HPyX folder [duplicate]

In my HOME folder, a folder named rPns20HPyX was automatically created. Inside that millions of files are accumulated. 1. What is going wrong, how these files are created ? Below are some screen-...
0
votes
0answers
162 views

rm -rf command can't delete a file. Ubuntu 14.04.03

I was trying to copy some files and I saw that I had already backed up the data, so I pressed Ctrl+C to stop the process. When trying to remove the backed up files, I was not able to delete the folder ...
5
votes
1answer
2k views

Piping find -name to xargs results on filenames with space not being passed to the command

Normally to remove files with spaces in their filename you would have to run: $ rm "file name" but if I wanted to remove multiple files, i.e: $ find . -name "*.txt" | xargs rm This will not ...
2
votes
2answers
431 views

Only delete files but not folders with rm

I have a directory like this: <folder1> <folder2> <folder3> file1 file2 file3 What is the rm command like that removes only file1, file2, file3 but leaves folder1, folder2 and ...
2
votes
4answers
341 views

Delete a list of directories stored in a file

I have a list of directories names in the following path /home/list/list.txt The directories are all in the following path /home/directory/ How can I delete the directories contained in the ...
6
votes
3answers
26k views

Syntax error near unexpected token `('

When I use below code in Ubuntu terminal, it works fine: rm !(*.sh) -rf But if I place the same line code in a shell script (clean.sh) and run the shell script from terminal, it throws an error: ...
9
votes
3answers
4k views

How to find the pid of the process which has deleted a file?

I am working on a project related to VM migration. Sometimes the VM image will disappear and I just want to know who the culprit is. I tried strace on suspicious processes but to no avail.
2
votes
1answer
39 views

Remove list of files from different subfolders

I have a folder (call "folder"), composed of different subfolders ("subfolder1", "subfolder2",...). I would like to remove a list of files in all the subfolder of "folder", while some files are ...
0
votes
0answers
15 views

Recover Directory Links

I've just erroneously launched this command: rm -R symbolic_link_to_dir and now if I go to DIR I can't see the content folders anymore. Fortunately if I enter with my FTP I can see all of the ...
0
votes
2answers
64 views

How to make a script delete a directory after checking for its existence?

How might one make a bash script which when run will check for the existence of a file/folder and if the file/folder is there remove it?
1
vote
3answers
166 views

remove pictures from folder

I want to remove all the photos from a folder and keep the remaining files. I searched in the web and I found a tons of solutions like: find . -type f -name "*.jpg" -delete All the photos are jpeg,...
0
votes
1answer
100 views

I removed /usr/lib/xorg by mistake, copying it from the live cd is enough?

The story(because it's kind of a funny fail): I have a remote target(ARM board) and I was testing one of my scripts that recreates the folder structure of my target but with local debug libraries for ...
2
votes
2answers
38 views

remove file with -h_some_file_name in shell [duplicate]

I have a problem when trying removing a file with name something like -h_some_file_name, this is because of generated script that I made and forget to check the prefix. If I run the command rm '-...
6
votes
1answer
775 views

How to recover accidentally removed /bin/ls binary

I have mistakenly deleted the ls executable from the /bin folder. Can I recover it or install it through the terminal?
8
votes
4answers
14k views

“No such file or directory” when trying to remove a file, but the file exists?

I am trying to remove a png image that was uploaded to my server via a PHP script. Whenever I try to delete it both through ftp and terminal, I get the error No such file or directory However, ...
-1
votes
3answers
945 views

Remove command not working

rm command not working.when i type command rm file name it giving me error No command 'trash' found, did you mean: Command 'crash' from package 'crash' (main) Command 'ktrash' from package 'kde-...