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:
Ps. ksh under Linux is itself pretty unusual.
Last edited by methyl; 08-23-2012 at 06:47 PM..
Reason: grammar and spelling
On a POSIX conforming implementation of the ls utility, the command:
would list all files in the current directory even if the first character in the filename is a <period>.
The command:
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:
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:
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.
@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?
@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:
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)
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)
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)
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)
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)
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)
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)
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)