This used to be the trick to hide folders in unix last time (not sure whether it’s still been used nowadays). Sometimes even the GUI file manager can’t go into the folders due to this unprintable control character.

It will appear something like this when you do a ls -al on shell prompt:

admin# ls -al
drwx-----x 13 user1 users 4096 Sep 27 14:40 /
drwx-----x 13 user1 users 4096 Sep 27 14:40 ./
drwxr-xr-x 82 root root 4096 Feb 9 07:51 ../
drwxr-xr-x 82 root root 4096 Feb 9 07:51 .. /
-rw-r--r-- 1 user1 600 0 Jun 28 2001 .addressbook
-rw-r--r-- 1 user1 users 124 Sep 10 2003 .bashrc
drwxr-xr-x 2 user1 600 4096 Oct 26 2004 Desktop/
drwx------ 23 user1 users 4096 Sep 17 19:19 Maildir/

The easiest way to get what control characters it used is by using the vi editor. First redirect the output of ls -al into a file, then use vi editor to open it.

admin# ls -al > out.txt
admin# vi out.txt

We should see something like this:

drwx-----x   13 user1   users        4096 Sep 27 14:40 ^A^A/
drwx-----x 13 user1 users 4096 Sep 27 14:40 ./
drwxr-xr-x 82 root root 4096 Feb 9 07:51 ../
drwxr-xr-x 82 root root 4096 Feb 9 07:51 ..^C^A^C/
-rw-r--r-- 1 user1 600 0 Jun 28 2001 .addressbook
-rw-r--r-- 1 user1 users 124 Sep 10 2003 .bashrc
drwxr-xr-x 2 user1 600 4096 Oct 26 2004 Desktop/
drwx------ 23 user1 users 4096 Sep 17 19:19 Maildir/
~
~
~

So now we know what control character was used, another problem rises. Trying to change directory to that folder by directly typing the exact control character (^A^A and ..^C^A^C) is almost useless, as it will become something else, for example ^C is actually an operation break/cancel command.

The trick is to use ^V (control+V) whenever you want to use any of the control character. So in this case we cant to change directory to folder ^A^A, this is what we should do:

admin# cd ^V^A^V^A

and same goes to the other one

admin# cd ..^V^C^V^A^V^C

Same thing can be done if you decide to remove the folders.

I had a chance to try this on Mac iBook G4 which is actually a unix based OS (darwin). Here is what I found.

Darwin will display the control character as ? (question mark), so our above example will looks like this on darwin:

drwx-----x   13 user1   users        4096 Sep 27 14:40 ??/
drwx-----x 13 user1 users 4096 Sep 27 14:40 ./
drwxr-xr-x 82 root root 4096 Feb 9 07:51 ../
drwxr-xr-x 82 root root 4096 Feb 9 07:51 ..???/
-rw-r--r-- 1 user1 600 0 Jun 28 2001 .addressbook
-rw-r--r-- 1 user1 users 124 Sep 10 2003 .bashrc
drwxr-xr-x 2 user1 600 4096 Oct 26 2004 Desktop/
drwx------ 23 user1 users 4096 Sep 17 19:19 Maildir/

and the good news is, it can be open with the Mac file manager, so I don’t see it to be any problem on Mac then.

Tags: , ,

Leave a Reply

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>