# # Removing an invisible or 'lost' file
APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

Deleting a "lost" file name

I've removed advertising from most of this site and will eventually clean up the few pages where it remains.

While not terribly expensive to maintain, this does cost me something. If I don't get enough donations to cover that expense, I will be shutting the site down in early 2020.

If you found something useful today, please consider a small donation.



Some material is very old and may be incorrect today

© July 2013 Tony Lawrence

I think I have serious disk corruption caused by my backup script. In a certain directory there is a lost file that looks like this:

rw-rw-rw- 1 root sys      593213440 Apr 27 10:21

I've tried to look at this file with FTP explorer but it doesn't show up. I've tried running fsck -s in single user mode as suggested from a support page on the Internet and it should've placed the file in the lost and found folder but did not.

First, you were misled by someone - this isn't a lost file and fsck can't fix it. There's nothing to fix as far as your disk goes - it isn't corrupt or damaged.

This is simply a large file with a name that "ls" can't show you. It HAS a file name- it probably has control characters in it that are confusing the display. Try this:

ls -b
 

That displays "unprintable" characters.

If that doesn't work, do "ls -l > /tmp/t" and then look at /tmp/t with a text editor - can you see the name now?

No? OK, "vi /tmp/t" and move to the line that it is on and type:

:l
 

That is, with your cursor on that line, type a ":" (which drops you to the bottom of the screen) and then type a lowercase "l" (ell) and press ENTER. If all else has failed, THAT will show you precisely what this file name is.

As I said, it probably contains control characters. Here's a similar file I just created on my system:

total 33352
-rw-r--r--    1 apl  apl        0 Jul 22 14:33  
-rw-r--r--    1 apl  apl      251 Jan  6  2010 2words
 

Using "ls -b" shows it's true name:

 \b\b\b
2words
 

It's a space followed by 3 backspace characters. I know the space is there because it doesn't line up with the next name.

Here's what it looks like in /tmp/t:

total 33464
-rw-r--r--    1 apl  apl        0 Jul 22 14:33  ^H^H^H
-rw-r--r--    1 apl  apl      251 Jan  6  2010 2words
 

And when using ":l" in vi

~                                                                               
~                                                                               
-rw-r--r--    1 apl  apl        0 Jul 22 14:33  ^H^H^H$
 

I assume you'd like to get rid of it? Now that you know its name and how long it is (in my example, 4 characters), that's easier.

$ rm -i " ^H^H^H"
remov?  
 

I got those backspaces in there by hitting CTRL-V and then CTRL-H. Notice that the normal "remove xyz?" got partially overwritten by the backspaces in the name.

I could have left out the "-i", of course.

Because I know the length, I could also have done:

rm -i ????
 

That might be easier.

If you can't do that, do "ls -i" to find out the inode number,reboot go to single user mode (or unmount the filesystem if possible), use clri to remove the inode, and then do a fsck.

Finally- fix whatever the heck is wrong with whatever moronic script is doing this- it's completely stupid- if you don't understand the script, post it here and we'll dissect it..

If you found something useful today, please consider a small donation.



Got something to add? Send me email.





(OLDER)    <- More Stuff -> (NEWER)    (NEWEST)   

Printer Friendly Version

->
-> Removing an invisible or 'lost' file


Inexpensive and informative Apple related e-books:

Sierra: A Take Control Crash Course

Take Control of Upgrading to El Capitan

Are Your Bits Flipped?

iOS 10: A Take Control Crash Course

Take Control of Preview





More Articles by © Tony Lawrence





Printer Friendly Version

Have you tried Searching this site?

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us


Printer Friendly Version





The three chief virtues of a programmer are: Laziness, Impatience and Hubris. (Larry Wall)




Linux posts

Troubleshooting posts


This post tagged:

Linux

Shell

Troubleshooting



Unix/Linux Consultants

Skills Tests

Unix/Linux Book Reviews

My Unix/Linux Troubleshooting Book

This site runs on Linode