Not visible hidden folder


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Not visible hidden folder
# 8  
Old 08-23-2012
Quote:
Originally Posted by methyl
This seems quite normal to me.
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.
# 9  
Old 08-23-2012
@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:
Code:
ls -ald .??*


Ps. ksh under Linux is itself pretty unusual.

Last edited by methyl; 08-23-2012 at 06:47 PM.. Reason: grammar and spelling
# 10  
Old 08-23-2012
On a POSIX conforming implementation of the ls utility, the command:
Code:
ls -a

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

The command:
Code:
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:
Code:
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.
This User Gave Thanks to Don Cragun For This Post:
# 11  
Old 08-23-2012
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.
# 12  
Old 08-25-2012
Quote:
Originally Posted by methyl
@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.
On what system does that happen?

Why bother having -a at all if it doesn't work?
Quote:
Most modern versions of ls include a switch to override the default behaviour.
Yes, which I thought was -a... what else is there, then?
# 13  
Old 08-25-2012
@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.
# 14  
Old 08-25-2012
@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.
This User Gave Thanks to Don Cragun For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Rsync - how to copy hidden folder or hidden files when using full path

Hello. I use this command : rsync -av --include=".*" --dry-run "$A_FULL_PATH_S" "$A_FULL_PATH_D"The data comes from the output of a find command. And no full source directories are in use, only some files. Source example... (2 Replies)
Discussion started by: jcdole
2 Replies

2. Solaris

Groups is not visible

OS : SunOS 5.8 I am trying to add a user ad3059 to the following groups, A B C D ( four groups A,B,C,D) When i use usermod command and add the user to the above groups, and go to > groups ad3059 other C D It doesnt show A and B groups and shows it as other.Please advice on how... (13 Replies)
Discussion started by: Revathi2089
13 Replies

3. UNIX for Dummies Questions & Answers

List all directories hidden or not hidden

I want to list all directories hidden or not hidden. ls -ld */ => shows only not hidden directories so i guess the answer would be to add the a option to show all files ls -lad */ => not working :confused: ls -la | grep "^d" => works But I would like to know why I can't use ls -lad... (4 Replies)
Discussion started by: servus
4 Replies

4. Solaris

folder not visible in ls -l

Hi, I have a strange problem. when i do ls i see a folder, say 'abc', but it disappears when i do ls -l. I cannot access or mv that folder. Solaris 10 (SPARC) doesn't allow me to create a new folder with the same name, as it already exists. 'file' command also doesn't recognize i 'abc'... (10 Replies)
Discussion started by: Mack1982
10 Replies

5. Web Development

images are not visible

hi, why my uploaded images are not visible both in front-end and back-end of my CMS ? See the picture: http://dl-client.getdropbox.com/u/72686/noPics.png I checked the GD library in php. It seems ok... http://dl.getdropbox.com/u/72686/GD.png thanks ---------- Post updated at... (0 Replies)
Discussion started by: aneuryzma
0 Replies

6. Shell Programming and Scripting

Finding Hidden files and protecting the folder containing hidden files from deletion

Hi. I have a script which is deleting files with a particular extension and older than 45 days.The code is: find <path> -name "<filename_pattern>" -mtime +45 -exec rm {} \; But the problem is that some important files are also getting deleted.To prevent this I have decide to make a dummy... (4 Replies)
Discussion started by: pochaw
4 Replies

7. Shell Programming and Scripting

Why are the xml tags not visible?

Could some one please tell me why, when I run the following php code: <HTML> <HEAD> <TITLE></TITLE> </HEAD> <BODY> <?php $readfile = file("rss_file.xml"); for ($k=0; $k<=count($readfile)-1; $k++) { echo "$readfile<br>"; } </BODY> </HTML> the tags do not appear in... (1 Reply)
Discussion started by: photon
1 Replies

8. UNIX for Dummies Questions & Answers

how to copy hidden files from one folder to another

dear all, i want to copy all files in my home dir to another. from my home dir i have given ls -la then some hidden files are there with dot . .. and i also want to copy all dirs in my home as it is . because iam upgrading the system how to copy all files and dirs in my home dir... (1 Reply)
Discussion started by: rajan_ka1
1 Replies
Login or Register to Ask a Question