Questions relating to the Linux remove command (rm)

learn more… | top users | synonyms

1
vote
0answers
32 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
374 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
49 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
36 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
63 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
41 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
107 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
22 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
109 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
80 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
61 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
68 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
239 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
142 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: ...
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 ...
0
votes
0answers
95 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 ...
4
votes
1answer
790 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
195 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
282 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 ...
5
votes
3answers
14k 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
32 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
14 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
51 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
102 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 ...
0
votes
1answer
73 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 ...
0
votes
0answers
328 views

Wget and delete file on url

Please assist. I need to know how to go about getting a file from my url and then deleting that file from the server. More detail. My script will do a wget from my server and put the file locally ...
2
votes
2answers
31 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
664 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
7k 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
43 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
34 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’: ...
64
votes
6answers
14k 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
2k 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
205 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
45 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 ...
2
votes
2answers
524 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
314 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
406 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
2k 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
294 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
106 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
4k 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 ...
1
vote
2answers
195 views

Unable to delete file

I am unable to delete file: sudo rm /usr/local/bin/Katy Perry - Dark Horse (Official) ft. Juicy J-0KSOMA3QBU0.mp4.part It is showing an error: bash: syntax error near unexpected token `(' How to ...
3
votes
5answers
715 views

Cannot delete Directory, doesn't exist?

Somehow this folder got created when i was logged in via sftp. "Sep 19 18:50 " I tried to delete it via sftp. Tried to SSH in and delete with rm -rf as root Error: rm ...
0
votes
2answers
146 views

Understanding rm command

I've been using Ubuntu server at home for a while now, and I've noticed I've some holes in my knowledge of bash and in general several dangerous tools like rm. It is first time in my life I used rm ...
2
votes
4answers
2k 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 └── ...
3
votes
2answers
1k views

How to prevent directory from being deleted by user?

Suppose a directory dir1 is created by sudo on Desktop. sudo mkdir dir1 Then I applied chown and chmod as following: sudo chown root:root dir1 sudo chmod go-rwx dir1 Now dir1 is only accessible ...
-1
votes
1answer
83 views

I cannot delete a folder from a driver (ubuntu 13.04) [closed]

When i try to delete a folder from a drive its saying through UI Error while deleting. Could not remove the folder New_Movie When i clicked show details , its showing Could not remove the folder ...