Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [delete]

Deleting usually means the act of removing files from their former locations on the system.

158
votes
3answers
292k views

How do I make rsync delete files that have been deleted from the source folder?

I recently set up a machine with Ubuntu Server to host game servers. I installed a backup plugin for each game server that creates frequent backups of game world files in a particular folder on the ...
68
votes
5answers
593k views

How do I remove a folder?

I am a new user and I am trying to remove a specific folder. I am using sudo rm /path/, but it is not working. What is the correct command to use? It is a file catolog I am attempting to remove but ...
62
votes
2answers
181k views

Removing files older than 7 days

I write below command to delete all files that are older than 7 days, but it doesn't work: find /media/bkfolder/ -mtime +7 -name'*.gz' -exec rm {} \; How can I remove these files?
60
votes
2answers
70k views

How do I remove all files that match a pattern?

When I revert in Mercurial, it leaves several .orig files. I would like to be able to run a command to remove all of them. I have found some sources that say to run: rm **/*.orig But that gives me ...
54
votes
4answers
58k views

How do I delete all empty directories in a directory from the command line?

Say I have a directory named foo/. This folder includes subdirectories. How can I delete all the empty directories in one command?
35
votes
10answers
73k views

Why do I get “Directory not empty” when I try to remove an empty directory?

I have this empty directory, but I keep getting the following error message: Cannot remove test: Directory not empty I know this question has been asked plenty of times but none of them helped. I ...
29
votes
3answers
56k views

Is it safe to delete a lost+found folder?

I have an empty seperate partition used for my vhd/virtualbox. mounted at /mount/win7. I've deleted everything now and there's a lost+found folder left over. It takes up about 5gigs Is it safe to ...
26
votes
1answer
18k views

Deleting contents of ~/.local/share/Trash/expunged …?

Is there a safe way of deleting contents of ~/.local/share/Trash/expunged ? I see It has lots of files & folders I had deleted -- from the trash as well. They are taking a lot of disc space. ...
23
votes
8answers
140k views

How do I remove my Ubuntu partition from Windows 7 and reuse the space?

I am dual-booting Windows 7 and Ubuntu, both installed on separate partitions. I don't need Ubuntu anymore. How can I remove the Ubuntu partition(s) and add the reclaimed space to my Windows 7 ...
20
votes
5answers
65k views

Can I delete /var/log files due to low root space?

Just had the message: Low disk space.. 2 GB left Judging by a posted message on ubuntu.org forums, I found that I have a .log file in /var/log at 22 GB in size! My root is an 82 GB partition and ...
19
votes
4answers
68k views

Delete all files whose filenames contain a particular string?

I changed my wordpress theme. The older one created so much images on server. My new theme doesnt need them, so I want to remove all. How can I do that? For example: Default image: ...
19
votes
4answers
43k views

How do I delete a hard link?

Recently I created a link with the following: sudo ln -n originalFileLocation How do I delete a hard link?
18
votes
4answers
36k views

What does rm -rf do?

What does rm -rf do when used to remove files or directories? How do the -r and -f options work together?
17
votes
2answers
65k views

How can I remove all files from current directory using terminal? [duplicate]

I use Ubuntu 14.04 LTS. I tried rm 'ls', rm rf but they did not work.
16
votes
4answers
74k views

How to delete all the files with a certain extension from a folder and all of its subfolders? [duplicate]

I want to remove all the .jpg files from my Music folder in order to save room. My Music folder contains subfolders, and I would like to know if there is a command to remove all the .jpg files from ...
15
votes
5answers
6k views

Is it safe to delete every hidden folder in the home directory?

My $HOME (otherwise known as '~') directory has lots of hidden configuration folders. Is it safe to delete all of them? To be specific Will the OS break if I do so? Will my ethernet/printer/sound/...
15
votes
1answer
5k views

Is it possible to delete files when another filesystem is mounted on the path?

Having just written an answer about moving /usr to a new partition I was wondering about deleting files once a new partition has been mounted. To use the example from the question, is it possible to ...
15
votes
2answers
56k views

How to recover Deleted Files and Folders?

How I can restore files and folders. I've deleted my home folder recursively. :(
14
votes
1answer
2k views

What's wrong with this 'find' command?

I am executing the following command (to find all files with .ts extension and deleting them): find . -type f -name "*.ts" –delete An error shows up: find: paths must precede expression: `–delete' ...
14
votes
2answers
42k views

Auto delete files older than 7 days

I am a complete noob at linux but I am starting to get the hang of it. I have an Ubuntu Server 16.04 running an FTP server to backup security video files. The files will be stored in folders like: /...
14
votes
7answers
85k views

Why I can't delete a folder?

Could not remove the folder [Folder name]. Show more details Error removing file: Directory not empty Cancel-Skip All-Skip I tried to delete these folders from terminal with: rm -r
13
votes
2answers
1k views

Are there any disadvantages of using rm $(ls) to delete files?

I was wondering if using rm $(ls) to delete files(or rm -r $(ls) to delete directories as well) was safe? Because in all the websites, people give other ways to do this even though this command seems ...
13
votes
2answers
10k views

How to delete all the settings for Deja Dup

When I upgraded to 11.04 Deja Dup started behaving strangely, it would begin a new full backup everytime the computer was started because it was looking for a drive and folder which I had removed some ...
12
votes
2answers
2k views

How to make my system delete all the files in a certain directory older than a certain time while keeping the directory structure intact?

I have a directory on my machine, think of it as my own sort of tmp directory, but it's in my ~ directory. And I want to make it so that my system every 3 hours deletes all the files in (though ...
12
votes
3answers
8k views

Removing sources after building from them

Suppose, we've built some package from sources (configure make install). May we remove sources directory after successful building? Or it depends? On what, then?
12
votes
11answers
30k views

Unable to delete file - no such file or directory

How can I delete a file that is there but the system says is not there?
11
votes
4answers
93k views

How to delete/edit files from readonly filesystem

I am having problem with my memory device (actually a memory card that act external memory device like pendrive). experimentx@workmateX:/var/www/zendtest$ sudo rm /media/A88F-8788/python-2.7.1-...
11
votes
1answer
9k views

help, can't empty my trash folder on external hdd

I've been searching for this problem on the webs but none of the solutions i've found worked for me. The problem is that I have an external hard drive and the trash folder won't delete. the complete ...
10
votes
5answers
23k views

How to recursively remove .svn metadata folders?

I have a Java project and it used a SVN repository, now I decide to change to GIT. However the problem is that SVN engine that I used created in every folder of the project the .svn metadata ...
10
votes
2answers
3k views

What happens if you Trash the Trash?

I was just wondering what would happen if I went and moved the Trash located here: /home/neo/.local/share/Trash To my Trash? I mean if I go to that folder and right-click on the contents and tell it ...
10
votes
2answers
4k views

How do I delete the target of a symbolic link without deleting the link itself?

I have a symbolic link ~/Desktop/test.txt which points to ~/rendu/test.txt. I know ONLY the path of ~/Desktop/test.txt, I want a fast way to delete ~/rendu/test.txt WITHOUT deleting the symbolic link....
10
votes
2answers
1k views

Intercepting calls to rm, and directing deleted files to trash instead

Is there a way to intercept calls to rm, and instead of permamently deleting the files, moving them to trash instead?
10
votes
1answer
29k views

How to completely remove and reinstall Ubuntu?

I want to reinstall Ubuntu, but I also want all information and settings to disappear. So everything looks like the first time I installed it. Is it possible to do so via Terminal? Or what are the ...
9
votes
1answer
668 views

Why does deleting a folder from the command line take longer than manual deletion? [duplicate]

I noticed whenever I want to delete a folder containing a lot of data using a command line (sudo rm -r folder_name), the Terminal hangs on for the operation to terminate. But at the same time, when I ...
9
votes
1answer
2k views

How to prevent a file under user folder to be deleted?

How can I make some file impossible to be deleted by user even if it is under his/her home folder?
9
votes
2answers
7k views

How is rm command different from the delete button?

I read from a book where it says, the command rm deletes the inode and not the file. Which means if I delete with the rm command, then it cannot be restored. I'm very new to Ubuntu environment. Now ...
8
votes
2answers
681 views

Is there a significant disadvantage to aliasing rm to do something else?

I've been bitten a few times recently with rming things I shouldn't have - for example, forgetting to ulink symlinks, not rm them. I'm thinking of writing a small bash script to simply move the ...
8
votes
2answers
358 views

How to delete folder with strange name? [duplicate]

I don't know how I've done this but I've created somehow a folder named "-p". Now I'm trying to delete it but my buntu is thinking I'm passing -p as a paremeter. What can I do? Ubuntu Server 15.
8
votes
2answers
10k views

Ubuntu deleted files from guest account desktop

I have Ubuntu 12.10 and was using guest account. I downloaded some files on desktop and shutdown my m/c after use. Now today when I logged in to guest account to copy those files but surprisingly ...
8
votes
4answers
6k views

Delete confirmation missing when I hit the delete key

I'm sick of accidentally deleting files and directories as DEL button is badly located on my keyboard. I would really like it if ubuntu asked me to confirm before deleting anything. Is there a way to ...
8
votes
1answer
3k views

How to free up the memory in the best way

I'm using Ubuntu 18.04 and 4GB RAM with CPU 4. I don't have too much memory left, so my computer works slowly and crashes. What would you recommend me to remove from directories? Or some command other ...
7
votes
4answers
1k views

What happens if I attempt to delete Ubuntu itself while logged in?

What would happen if I delete the / directory while logged as root into Ubuntu? Would I get some sort of error to the effect of Error: unable to self-destruct? Or would I actually be able to delete ...
7
votes
1answer
12k views

Where is the delete account button in Thunderbird on Ubuntu 12.04

I was unable to find the "Delete account" button in Thunderbird on Ubuntu 12.04. Saw posts saying that I can find it at the bottom left side, but could not find it. Please help me find that button.
7
votes
1answer
23k views

How to recover deleted folders or files (by shift+delete) from an NTFS partition

I have a 80 GB hdd in which Ubuntu is installed alongside windows. I also have a 500 GB hdd having 3 partitions in which i store my data. Actually i mistakenly deleted a folder permanently in one of ...
7
votes
2answers
661 views

Is there a way to recover a file that I have deleted but is still open somewhere?

This question is related to How to recover deleted files? but it is slightly different in nature. Suppose I have a file named ~/something open in a text editor. Further suppose that I open a terminal ...
7
votes
2answers
3k views

Disable shift-delete for file deletion

As an re-education procedure in order to reduce (likely) future data loss, I wish to disable the Shift+Del functionality to delete files in Ubuntu (11.10 and 12.04). Also, if I could replace it with a ...
7
votes
1answer
12k views

Can I safely remove all the files in /tmp?

I want to make free space on my computer, and Baobab tells me /tmp is 8 Gio large. Can I delete all the files in /tmp safely? Do I have to close some programs first? Additionally, why is this ...
7
votes
1answer
1k views

Can't move files to trash without any permission issues

This is not like one of the cases addressed before - I've checked them all. I've suddenly begun getting that message "... can't be put in the trash. Do you want to delete it immediately?" this ...
7
votes
2answers
162 views

How to delete folders that have n or fewer files in them?

I need to do some folder clean-up, and I'd like to remove directories that have 10 or fewer files in them. I tried looking at GNU's find, but there wasn't anything related to the number of files in a ...
7
votes
1answer
1k views

Impossible to trash files from a folder which is a symbolic link to a NTFS partition folder

Since a few days and the upgrade of my Ubuntu from 14.10 to 15.04, I cannot send files to trash anymore from some folders. When deleting from Nautilus, I now get a popup saying: “aaa.png” can't be ...