Not visible hidden folder

Hi,

In one folder there is a hidden folder. Whenever i do any

 ls -a 

i can't see the folder. However i can get into the folder by

cd .foldername

.
Would you please help me to identify what is the problem here.

As usual, it may OS specific but you dont mention your OS nor ist version nor the shell you use...

vbe,
OS and version: Linux hn747c3n14 2.4.21-47.0.1.ELhugemem #1 SMP Fri Oct 13 17:48:02 EDT 2006 i686
Shell: ksh

Are you using a special file manager? (e.g. Nautilus...)
what does

 ls -ald .foldername 

return?

1 Like

no i didnt use any file manager..i just use putty..

ls -ald .foldername

works fine, but how can i see that hidden file if i didnt know the foldername...
i tried

ls -ald

and didnt get the folder..

Is .foldername a remote directory that's automounted just when accessed?

---- EDIT ----
Sorry, I read now the last messages: if ls -ald .foldername always works, I obviously missed it.
--
Bye

This seems quite normal to me. We must assume that you are not logged in as root.

If you want to see all "hidden" files and directories:

ls -ald .??*

Btw:

ls -lad

Will not display anything useful because it has no file list to process.

1 Like

How so? ls -a should exclude nothing, yes?

Certainly if he was typing the foldername, then it would show empty contents for an empty folder, but just ls -a without a foldername ought to list it.

That ls -a excludes a folder is pretty inexplicable. Linux doesn't have hidden files or folders, really, just a convention that folders beginning with . are ignored by ls unless you give -a.

@Corona688
Apart from being Operating System dependent (there is much variation), the rule of thumb is that when you are logged in as root the ls -a shows all files but when you are logged in as a normal user the dot (aka "hidden") files are excluded.
Most modern versions of ls include a switch to override the default behaviour.

For portable scripts I still use:

ls -ald .??*

Ps. ksh under Linux is itself pretty unusual.

On a POSIX conforming implementation of the ls utility, the command:

ls -a

would list all files in the current directory even if the first character in the filename is a <period>.

The command:

ls -A

would list all files in the current directory even if the first character in the filename is a <period> except that the directories "." and ".." will be skipped.

I'm used to using a POSIX conforming ls, so I had never seen the command:

ls -ald .??*

to perform a long listing of all files in a directory. But on a conforming implementation, it would miss files with names like ".x" that I think you would want to print if you were trying to implement the -A option without using -A.

1 Like

I've carefully avoided posting the command switches to ls because there is no real consistency of syntax or behaviour across unix/Linux variants.
A very high proportion of posters on this site are not running a POSIX-compliant system. This is because the POSIX "standard" changes so frequently that virtually no mature system ever complies with the current "standard". This situation has been running for many many years and has become an industry joke.

(Second sweeping generalisation tonight).
There is no standard "dot" file or directory from any standard system application or commercial application which has a single character name (plus the dot).
Replies on a postcard.

On what system does that happen?

Why bother having -a at all if it doesn't work?

Yes, which I thought was -a... what else is there, then?

@Corona688
See -A posted above (just one variation). Highly depends on what O/S you have and whether you are root or not.

Try commands as non-root and as root.

There is a reason why dot files are known as hidden files.

@methyl
All of the ls man pages listed in the Man Pages tab in this forum say that -a prints all entries including those whose first character is dot. The freeBSD and OS X ls pages say that -A is on by default for super-users. The freeBSD man page also says that -I can be used to disable the default setting of -A for super-users.

1 Like