Questions relating to the Linux remove command (rm)

learn more… | top users | synonyms

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 ...
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 ...
3
votes
3answers
58 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
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
61 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 ...
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
86 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 ...
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
1answer
472 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 ...
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
1answer
744 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, ...
0
votes
0answers
65 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 -...
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
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 ...
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 ...
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? ...
0
votes
1answer
110 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
602 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
239 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
161 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
422 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
340 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
25k 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: ...
2
votes
1answer
38 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
165 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
99 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
773 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
vote
0answers
46 views

all my previous configurations and settings are gone by using the following command in ubuntu 14.04LTS

I used the command rm -rf ~/.Trash/* to empty the trash but when the command is executed, all my files in Download folder are deleted and all my Ubuntu settings are changed. Can anyone please help, ...
0
votes
2answers
38 views

I just want to remove the file from directory

I am trying to remove a file with: ubuntu64@ubuntu:/usr/local/mongodb$ rm /usr/local/mongodb/* But every time it just outputs: rm: cannot remove ‘/usr/local/mongodb/mongodb-linix-x86_64-2.6.4’: ...
65
votes
6answers
21k views

How is 'rm -rf /' able to delete all files in the system?

I haven't tried this command on Ubuntu (for obvious reasons) so I am not sure if Ubuntu will allow its execution. But it's famous for deleting everything. Just out of curiosity, what happens when the ...
1
vote
1answer
4k views

how to restore data after running rm?

I accidently run sudo rm * I thought I was in an unimportant subfolder. The result is that I deleted some very important files, unfortunately. Is there any hope to get my data back ?
2
votes
1answer
267 views

Accidentally removed /var folder

I did something real dumb. I was creating tarballs of files in my /var/ folder. The tarball i created was put into /tmp/test.tar In the process of testing the extraction process, I meant to delete /...
0
votes
0answers
18 views

VLC cannot be installed , [duplicate]

I installed KDE desktop before and am not able to login to kde so , i removed it using sudo remove kde* Then there was audio not working, so i re installed drivers. it is working fine, but for some ...
1
vote
2answers
65 views

how to remove files that are smaller than certain dimensions

I have already found an answer that lists pretty much everything. Except I cannot get it to work. I use: find . -iname "*.jpg" -type f | xargs -I{} identify -format '%w %h %i' {} | awk '$1<...
2
votes
2answers
843 views

Find folders of size lesser than x and delete them

I want to find all folders (within a folder) which are less than 100mb large and delete them. I actually don't want to use a bash script. But probably there is some neat one-line-loop possibility to ...
0
votes
1answer
405 views

Can't create files on desktop in Ubuntu 14.04

I accidentally created a desktop shortcut in my home directory. To remove it, I did sudo rm -rf Desktop Now I can't create files and folders on my desktop.
4
votes
1answer
748 views

Difference between commands for removing empty directories

What is the difference between rm --dir <directory> and rmdir <directory> with respect to removing empty directories? Also, if they are similar, is there any advantage of having an rmdir ...
1
vote
4answers
3k views

Undo sudo rm -R /*

I stupidly ran sudo rm /* followed by sudo rm -R /* My sites still run, although the vast majority of commands like ls are now broken. Is there a simple way to get data off the server or reverse ...
1
vote
1answer
489 views

Can a directory's mtime be older than that of file inside?

I have this very silly and very basic question but I thought better to ask before I start pruning my NAS. I want to delete all directories in which all files are older than 30 days. For files I ...
3
votes
2answers
134 views

How to remove a directory without a name?

ls -l output: drwxr-xr-x 10 mnevile mnevile 4.0K Sep 9 15:45 ​​ drwxrwxr-x 18 mnevile mnevile 4.0K Jun 16 16:01 movies/ drwxrwxr-x 16 mnevile mnevile 4.0K Aug 19 10:52 music/ drwxrwxr-x 16 mnevile ...
7
votes
4answers
2k views

How can I delete a file if it starts with <html> in bash?

I need a bash command to delete the entire file if the file itself begins with <html>. I'm not sure the best way to go about this... Context: I download a series of files via curl requests. ...
23
votes
2answers
5k views

Does using -v (verbose) slow commands down?

In this question: How to remove all files and subdirectories in a directory WITHOUT deleting the directory in bash? it is asked how to delete all file in a folder, and not the folder itself. Matts ...