12

I deleted it once, but it's ghost is still there :)

How can I delete a file that is there but the system says is not there?

Permissions tab - tried changing it, but it would reset itself automatically This is what happens when I click "Delete"

10
  • This is a warning. What does it say if you choose "Delete"? Jul 15, 2012 at 23:14
  • Right click the file, choose Properties, open the Permissions tab. Please take a screenshot and post it here. Jul 16, 2012 at 0:31
  • Can you move other files to the trash? Is the file you are deleting on the same file system as your home file system? Does the directory ~/.Trash/ exist? Jul 16, 2012 at 1:17
  • John, I can move other files to the trash normally, just this one gives me trouble.
    – Valeriu
    Jul 16, 2012 at 17:50
  • Did you try to delete it from the terminal? sudo rm panorama.jpg Jul 16, 2012 at 17:58

11 Answers 11

3

I know this is old, but I had the same problem as yours, only with a folder, not with a file. None of the methods suggested here worked.

I managed to solve the problem by creating a folder in the same position and with the same name as the one I couldn't delete. The folder was created correctly and it "replaced" the non existing one. Then I simply removed the new folder and the issue was gone. Simple as that.

0
2

I had the same problem. It was a problem in index entries of the partition. I solved it by start Windows if your system is dual boot or insert live CD of Windows XP or Windows 7, and then do the following steps:

  1. Search for COMMAND PROMPT that: is cmd right-click -> Run as administrator.
  2. chkdsk /f/x D: (where D is your drive letter).
  3. Press Y if it asks for Y/N
  4. Check your drive for the file that you want to delete. Maybe it is deleted or you can delete it.

100% working

2

Warning: These instructions will require one to use debugfs. They can cause data loss.

They are tailored to the original problem and may or may not be accurate for any future visitors on this page. Any data loss may be irreparable or even aggravated by fsck.

It may be a lost inode. Please run ls -li to get a list of inode numbers, then you can try to dump the referenced inode. For example, if your ls -li looks like the following:

rarkenin@ubuntu-alt-64-vbox-1:~$ ls -li
total 58672
4980758 -rwxr-xr-x 2 rarkenin rarkenin     4096 Sep 23 18:45 panorama.jpg
---SNIP---

then the inode number is 4980758 as shown in the list as the first column.

You can then try to dump the inode. Please read the entire post before doing anything.

  1. Start debugfs as root:

    rarkenin@ubuntu-alt-64-vbox-1:~$ sudo debugfs
    [sudo] password for rarkenin: 
    debugfs 1.42 (29-Nov-2011)
    debugfs:  
    

    and give the command open /dev/sda1 with the correct block device for your partition.

  2. Then, give the command to dump the inode whose number you got earlier:

    cat <4980758>
    

    using < and > around the inode number.

  3. If it reads some random text, close the terminal and open it again. Run debugfs again and give the open command again.

  4. Now, you can try to delete the file. This can result in severe filesystem corruption.

    debugfs: rm [filename]
    
    debugfs: unlink [filename]
    
    debugfs: kill_file [filename]
    
    debugfs: kill_file <inode>
    

Note that this can be done even if it turns out the file never had an inode. Try the commands one at a time, in the order shown above. Exit debugfs and check if the file exists. If not, begin again but follow the next instruction.

Make a backup if possible!

2
  • Does not work for my NTFS filesystem
    – Suici Doga
    May 22, 2016 at 4:23
  • @SuiciDoga debugfs is only intended for ext2, ext3, and ext4 filesystem types.
    – nanofarad
    May 22, 2016 at 13:38
0

First log in as root with sudo -s

You can try doing rm -v <file> and look out the verbose output to see whats going on while its trying to remove the file. Check out the options for the command below.

If that fails, you can use the force option like everyone else said. You can also try removing the entire directory by forcing a recursive removal: rm -rfv **full directory address here**



From the UNIX Command Guide:

SYNOPSIS

   rm [OPTION]... FILE...

DESCRIPTION

   rm removes each file. By default, it does not remove directories.

   If a file is unwritable, the standard input is a tty,  and  the  -f  or
   --force  option is not given, rm prompts the user for whether to remove
   the file.  If the response is not affirmative, the file is skipped.

OPTIONS

   Remove (unlink) the FILE(s).

   -f, --force
      ignore nonexistent files, never prompt

   -i, --interactive
      prompt before any removal

   --no-preserve-root do not treat '/' specially (the default)

   --preserve-root
      fail to operate recursively on '/'

   -r, -R, --recursive
      remove directories and their contents recursively

   -v, --verbose
      explain what is being done

   --help display this help and exit

   --version
      output version information and exit

   By default, rm does not remove directories.  Use the --recursive (-r or
   -R)  option to remove each listed directory, too, along with all of its
   contents.

   To remove a file whose name starts with a '-', for example '-foo',  use
   one of these commands:

      rm -- -foo

      rm ./-foo

   Note  that  if  you  use rm to remove a file, it is usually possible to
   recover the contents of that file.  If you want more assurance that the
   contents are truly unrecoverable, consider using shred.
0

Looking at your screenshots I see you have the group set as root. I'd try using chown and see if it fixes the problem.

sudo chown -hR [username]:[username] /home/[username]

Replacing [username] with your username.

You'll get a couple errors.

example

1
  • mywebslave, I did what you suggested, showed me the same 'Permission denied' as in your screenshot. Still can't delete the damn file.
    – Valeriu
    Sep 27, 2012 at 20:48
0

Non printing characters in filenames can cause such problems -- like a space. Try the interactive option of rm, and say 'Y' to the file you want to delete"
rm -i "*pan*" Note the use of *s to match any (even non-printint) characters.
Could be the inode has been removed, but not the directory entry. Try ls -i to see the inodes. fsck the file system to fix this sort of problem.

1
0

Try this way:

cd dir-to-delete
find ./ -exec rm -rf {} \;
0

As ubfan1 said, non printing characters in filenames can cause such problems.

  1. touch
  2. rm

worked for me since 'touch' overrided the corrupted file.

0

I had a same problem with the file created by custom web base EMR (electronic medical record) under chrome. sudo touch /forcefsck followed by restart worked for me and aromatically deleted file. Taken help form following pages

  1. https://ubuntuforums.org/archive/index.php/t-1673273.html
  2. Force fsck safe?
0

Linux Mint 18.3 My non-existent file was ¨filename.pdf.crdownload¨ It showed up on my desktop as a package, i.e. a zip file in Windows speak. For the heck of it I did right click, Properties, Open with, which showed zero apps, so I changed it to Open With ¨Archive Manager¨. Immediately the file disappeared from my desktop. kb

-1

show us the terminal.... do a ll | grep panorama and show us that; add it to your question...

My suggestion is to do as root rm -f panorama.jpg.

in the man of rm I found this:

-f, --force
              ignore nonexistent files, never prompt
1
  • Tried that multiple times, both with -f and --force It did not help!
    – Valeriu
    Nov 11, 2012 at 11:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .