How to Change to Directories with Strange Characters in them
On Unix systems, people will sometimes create directories with strange characters in the names. These characters can make it more difficult to access the directories, providing a small amount of “security through obscurity.” This technique is used to try to hide information, most often warez (commercial software) or hacking tools.
There are several things you can do to determine what these strange characters are. One is to use the arguments to the `ls` command that cause `ls` to give you more information:
From the man page for `ls`:
- Causes directories to be marked with a trailing “/”,
executable files to be marked with a trailing “*”, and
symbolic links to be marked with a trailing “@” symbol.
- Forces printing of non-graphic characters in filenames as the
- Forces printing of non-graphic characters in the ddd
notation, in octal.
Perhaps the most useful tool is to simply do an `ls -al filename.txt` to save the directory of the remote ftp site as a file on your local machine. Then you can do a `cat -t -v -e filename.txt` to see exactly what those bizarre little characters are.
From the man page for `cat`:
- Causes non-printing characters (with the exception of tabs,
newlines, and form feeds) to be displayed. Control characters
are displayed as ^X (<Ctrl>x), where X is the key pressed with
the <Ctrl> key (for example, <Ctrl>m is displayed as ^M). The
<Del> character (octal 0177) is printed as ^?. Non-ASCII
characters (with the high bit set) are printed as M -x, where
x is the character specified by the seven low order bits.
- Causes tabs to be printed as ^I and form feeds as ^L. This
option is ignored if the -v option is not specified.
- Causes a “$” character to be printed at the end of each line
(prior to the new-line). This option is ignored if the -v
option is not set.
If the directory name includes a <SPACE> or a <TAB> you will need to enclose the entire directory name in quotes. Example:
On an IBM-PC, you may enter these special characters by holding down the <ALT> key and entering the decimal value of the special character on your numeric keypad. When you release the <ALT> key, the special character should appear on your screen. An ASCII chart can be very helpful.
Sometimes people will create directories with some of the standard stty control characters in them, such as ^Z (suspend) or ^C (intr). To get into those directories, you will first need to user stty to
change the control character in question to another character.
From the man page for `stty`:
Sets control-character to C, where control-character is
erase, kill, intr (interrupt), quit, eof, eol, swtch
(switch), start, stop or susp.
start and stop are available as possible control characters
for the control-character C assignment.
If C is preceded by a caret (^) (escaped from the
shell), then the value used is the corresponding control
character (for example, ^D is a <Ctrl>d; ^? is
interpreted as DELETE and ^- is interpreted as undefined).
You can use the `stty -a` command to see your current stty settings, and to determine which one is causing you problems.
Rate this article: