Questions tagged [delete]

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

In Ubuntu a file (directories are files too) may be deleted:

  • through the GUI, for example by pressing the delete key when the icon is selected or by clicking a button in a context menu. This causes the file to be sent to a location called Trash, where it will remain until Trash is "emptied"
  • by a CLI method, such as using the rm (remove) command, using the -delete option to find, overwriting a file with mv (move) and so on. There is no Trash or undelete for these methods, which clear the associated with the file. Although the file is still present on the disk, the operation cannot be reversed and the data may not be fully recoverable.
721 questions
388
votes
6 answers

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 machine. I also established a cron task to…
user254251
  • 3,953
162
votes
4 answers

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 the message: rm: cannot remove `**/*.orig': No such…
JD Isaacks
  • 5,497
133
votes
2 answers

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?
113
votes
6 answers

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 I am geting a message that it is empty.
Carl
  • 1,131
83
votes
18 answers

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 tried ls -la to make sure there were no hidden…
rbrick
  • 933
78
votes
6 answers

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?
0xnuminous
  • 11,280
72
votes
2 answers

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

I use Ubuntu 14.04 LTS. I tried rm 'ls', rm rf but they did not work.
alhelal
  • 2,741
64
votes
5 answers

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: 12_angry_men_lone_holdout.jpg I want to delete:…
55
votes
1 answer

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. After deleting the files & clearing the trash why are the…
maan81
  • 657
  • 1
  • 8
  • 26
51
votes
3 answers

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 remove a lost and found folder?
48
votes
5 answers

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?
TellMeWhy
  • 17,964
  • 41
  • 100
  • 142
46
votes
5 answers

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 Disk Analyser shows the offender to be in log. The…
Paul B
  • 765
43
votes
4 answers

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?
hawkeye
  • 4,107
39
votes
3 answers

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 than apt autoremove and apt autoclean because…
maria
  • 915
36
votes
7 answers

What is the ".Trash-1000" folder and how to delete it?

Can someone tell me what the .Trash-1000 folder is and how can I remove/delete it? It taking up 275 gigs of disk space.
zippy
  • 361
  • 1
  • 3
  • 3
1
2 3
47 48