12
4
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.