How do I show all hidden & invisible files on the command line (both .files and invisible flagged files)?
If the files are indexed by Spotlight and files in subdirectories can be included, you could use mdfind:

mdfind kMDItemFSInvisible=1 -onlyin .


Or test for both GetFileInfo -av (attribute invisible) and if the name starts with a period:

shopt -s dotglob nullglob
for f in *; do [[ $(GetFileInfo -av "$f") = 1 || $f = .* ]] &amp;&amp; echo "$f"; done


GetFileInfo is part of the command line tools package that can be downloaded from Xcode's preferences or from developer.apple.com/downloads.

Different ways to list only files that start with a period:

shopt -s nullglob; printf %s\\n .[^.]* ..?*
shopt -s dotglob nullglob; GLOBIGNORE='. ..'; printf %s\\n *
ls -a | grep -E '^(\.[^.]|\.\.[^$])'