Is it possible to make ls aware of the hidden file flag on Mac OS X?
Currently, a simple ls -lO produces:
$ ls -lO
total 0
drwxr-xr-x@ 84 danielbeck staff - 2856 29 Mai 22:44 Applications
drwx------+ 158 danielbeck staff - 5372 29 Mai 15:27 Desktop
drwx------@ 250 danielbeck staff - 8500 30 Mai 20:40 Documents
drwx------+ 11 danielbeck staff - 374 29 Mai 22:21 Downloads
drwx------@ 84 danielbeck staff - 2856 29 Mai 22:48 Library
drwx------@ 3 danielbeck staff hidden 102 3 Apr 20:45 Movies
drwx------@ 5 danielbeck staff hidden 170 3 Apr 20:45 Music
drwx------+ 215 danielbeck staff - 7310 29 Mai 22:54 Pictures
drwxr-x---@ 7 danielbeck staff hidden 238 3 Apr 20:45 Public
drwxr-xr-x@ 4 danielbeck staff hidden 136 24 Apr 23:25 Sites
So we have three kinds of visibility: regular, visible files, files with the hidden file flag, that aren't actually hidden in Terminal, and really hidden files whose names start with a dot.
Is there a way, e.g. using an alias or a reliable shell function, to make ls treat hidden flagged and .dothidden files the same, i.e. hide by default and show with ls -A or ls -a, similar to how Finder behaves depending on the value of defaults read com.apple.Finder AppleShowAllFiles?
I am aware that man chflags specifically mentions hidden flag only hides from GUI, i.e. Finder.




ls,awk,grepand their likes? – slhck♦ May 30 '11 at 21:31lsso much I'm restricted in how to use it, then that's an option. – Daniel Beck♦ May 31 '11 at 4:45hiddenattribute is also exposed viaxattr -p com.apple.FinderInfoat a different offset. I might write a totally newlsscript that does both colors and hidden flag ;) – Daniel Beck♦ Jun 11 '11 at 6:30