Problem with filenames

I am getting: PuTTYPuTTY everytime I list a particular directory with ls or ll. It does not happen in any other directory and I can’t see anything unusual in the directory so what is the problem?

For most terminal emulators, there is an AnswerBack feature, something that was implemented more than 40 years ago during the days of teletypewriters (Teletypes and other hardcopy communication machines). The ASCII character 05 or 0x05 is called the ENQ character and does not show on the screen or paper. Instead, when received, it triggers a response from the terminal to identify itself, to “Answer Back”. Most modern hardware terminals will answer with their model number such as vt100 or hp2392a, but for emulators, they can be programmed for any string. For the PuTTY terminal emulator, the default is “PuTTY“.

So the problem is being triggered by the text sent back by HP-UX, namely, the filenames. Normally, this requires a lot of trial and error to locate but there is a little known but very useful option for ls: the -b option to list non-printing characters. By using -b with ls, you will see the non-printing characters in their octal form:

ls -b
file1 file2 w250504 052300533004354

In this case, two files have special characters in the name, 05 being the ENQ character. Each ENQ character sent to PuTTY triggers the response. They were very likely generated accidentally, possibly by processing a directory instead of a file in a script. The first file can be removed with this command:

rm -I w25*

and answering yes when the correct file is displayed.

The second file is more problematic as there are no displayable characters in the filename. Since the file is exactly 5 characters, you can use the ? character to identify the 5 characters:

rm -i ?????
file1 : ? (y/n) n
file2 : ? (y/n) n
Øì: ? (y/n) y

– See more at: http://serviceitdirect.com/blog/problem-filenames#sthash.ngG4bGB7.dpuf


Tags: