Operating System - HP-UX
1832492 Members
4896 Online
110043 Solutions
New Discussion

"Magic" file/directory - how to ?

 
Roman Dijanosic
Advisor

"Magic" file/directory - how to ?

Anybody heard about magic file/directory? Supposed to
be that kind of file/directory that doesn't show up in directory listing, but can be accessed only when referenced explicitly by its name...

How is done such "magic" file? To my knowledge
"everything" is listed in directory list. Shouldn't (or I am wrong...) also be the matter od permissions. If you
can't access some file/directory you should at least from
viewing directory list see that the file is there...


Roman D.
6 REPLIES 6
Victor_5
Trusted Contributor

Re: "Magic" file/directory - how to ?

Hi Roman:

Maybe some invisible characters in front of the names or behind them, so you can not list them through regular command but can access them by exact name, try

ll *file_name
or ll file_name*


MANOJ SRIVASTAVA
Honored Contributor

Re: "Magic" file/directory - how to ?

Hi Roman

If you are talking of hidden directories like in DOS I dont think u can have them in Unix , however direcotires created with special characters or starting with . donot get listed in ls -l commnad but definaltey u can see them in ls -la option.


Manoj Srivastava
James R. Ferguson
Acclaimed Contributor

Re: "Magic" file/directory - how to ?

Hi Roman:

Perhaps you want to do an 'ls' with the '-a' and '-b' flags.

The '-a' (for non-root users) lists files whose names begin with a period (.).

The '-b' flag forces printing of nongraphic characters in octal \ddd notation.

...JRF...
Carsten Krege
Honored Contributor

Re: "Magic" file/directory - how to ?

Never heard of such a feature. Like Shawn, I can only think of some creative approaches.

The first, not so creative one is to use a file starting with a ".", e.g. ".foobar"
Non-root users will only see the file when using "ls -a".

The second, a bit more creative, is to create a file "foobar", where is the cursor key with the arrow pointing up. This file would be "unvisible" as long as it is not the last file in the "ls -l" listing. It can be made visible using "ls -lb" though.

In a similar way you can construct a file that becomes unvisible for specific situations.


Carsten
-------------------------------------------------------------------------------------------------
In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move. -- HhGttG
Victor_5
Trusted Contributor

Re: "Magic" file/directory - how to ?

Sorry, it was my mistake, forget about my first message.

Regards,
Shawn

Roman Dijanosic
Advisor

Re: "Magic" file/directory - how to ?

Frankly speaking I was aiming in completely different area. Has anybody using NetApp's (Network Appliances) filers?

Well acording to what the are saying (System administration guide or something) every subdirectory
of the "snapshoted" directory has its own ".snapshot"
directory except that it is "hidden" and that "subdirectory
.snapshot" doesn't show in (normal) directory listing.
(they say if that wouldn't be so, many comandy like find, ls etc. would work correctly). They only "let" that "root"
".snapshot" directory is shown up...

I was just wondering how they do that... It doesn't fall
in my mind that can use "trick" with "control characters".
I will check...

Roman D .