LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   a phantom file in my home dir (https://www.linuxquestions.org/questions/debian-26/a-phantom-file-in-my-home-dir-378826/)

microsoft/linux 10-31-2005 11:38 PM

a phantom file in my home dir
 
I was trying to write a script and something got messed up(I eventually got the script working, in case you were wondering). Now I have a phantom file called sftp. It shows up in ls, the output of 'll' is here'
Code:

<useless stuff removed>
-rw-r--r--  1 jake jake        96 2005-10-29 18:12 stfp
<more useless stuff removed>

however, when I try to run 'll sftp' it tells me the file does not exist. The same thing happens when I try to remove it. Does anyone have any suggestions? It's more of an annoyance, so I can live w/ it, but I would like it removed

CroMagnon 11-01-2005 12:18 AM

Assuming you haven't made a typo, you've made a typo.

The file is called 'stfp' not 'sftp'. I imagine you mistyped it in the script, but since you're familiar with it you know it should be 'sftp' and this is why you have the problem :)

bentb 11-01-2005 04:02 AM

The filename may contain nonprinting characters. This could explain why you see it with 'll' but not with 'll stfp'. One way of getting it removed is this:

rm -i *

The '-i' is *very* important as it makes rm interactive and prompts you before removing any file. As a precaution you can move all the 'good' files away to a safe place before attempting the delete.

Have fun

Bent

bigearsbilly 11-01-2005 04:12 AM

ls -b

will show if you have non-printing chars in the filename

chenglim 11-01-2005 06:19 AM

rm -f sftp

or

rm -f stfp

leif81 11-01-2005 06:34 AM

Does tab completion work on the file name?

makuyl 11-01-2005 07:01 AM

Another one to try is: rm *stfp*
but make sure no other filenames contain that string.

microsoft/linux 11-01-2005 08:46 AM

wow...I feel stupid. I know I haven't made a typo giving you the output, I copied and pasted. Thanks you guys!

alf55 11-01-2005 09:11 PM

Re: a phantom file in my home dir
 
Quote:

Originally posted by microsoft/linux
I was trying to write a script and something got messed up(I eventually got the script working, in case you were wondering). Now I have a phantom file called sftp. It shows up in ls, the output of 'll' is here'
Code:

<useless stuff removed>
-rw-r--r--  1 jake jake        96 2005-10-29 18:12 stfp
<more useless stuff removed>

however, when I try to run 'll sftp' it tells me the file does not exist. The same thing happens when I try to remove it. Does anyone have any suggestions? It's more of an annoyance, so I can live w/ it, but I would like it removed

you should try doing "ls -l --escape *stfp*" as the "--escape" option puts the non-printable characters to be escaped and visiable. such as leading space(s) or other control characters. You see that all most any character is allowed in a filename (even though several characters should be avoided due to having to quote them).

microsoft/linux 11-01-2005 11:02 PM

wow, I really do feel stupid:rolleyes:. It was as simple as
Code:

rm stfp
Thanks for all the info on non-printing characters and stuff though

RWallett 11-01-2005 11:38 PM

Quote:

Originally posted by microsoft/linux
wow, I really do feel stupid:rolleyes:. It was as simple as
Code:

rm stfp
Thanks for all the info on non-printing characters and stuff though

Not to worry--you aren't the first person to do that, and somehow I doubt you'll be the last :D

archtoad6 11-04-2005 10:08 AM

Lot's of interesting ideas, obvious time to re-read the ls FM.

Midnight Commander (mc) is a great way to deal w/ non-printing & suspected non-printing characters. It's close to the 2nd thing I do & the 1st thing I install on a new box:
Code:

apt-get install mc

bigearsbilly 11-04-2005 10:12 AM

it's amazing how much you don't know about even basic commands until you RTFM.
The Great thing about unix/linux is that it's inexhaustable.

archtoad6 11-04-2005 10:27 AM

Landmark: my post # 600

Maybe we ought to change, at least occasionally, "RTFM" TO "RRTFM" -- as in re-read ...

Two of my "favorites" that I keep going back to are: ls & less. They both are amazingly rich. I also go out of my way to post code snippets that use what I see as the coolest features of each. I hope to pique people's interest in "what's that weird option" & provoke an RTFM.


makuyl 11-04-2005 10:32 AM

With the risk of going OT, the problem with complete newbies isn't (hopefully) lack of wanting to read, it's not knowing where to start and what to read as well as not understanding what the man pages say.
http://www.linuxlinks.com/Beginners/ is a good place to start imho.


All times are GMT -5. The time now is 01:06 AM.