Not really. What you seek isn't something shells try to support. Shells are really about open access to a system, not hidden access.
Some shell commands and functions will ignore directories and files that are prefixed with a .
by default. For example, ls
does this:
IanCsiMac:~/code/tmp
> ls
IanCsiMac:~/code/tmp
> ls -lah
total 16
drwxr-xr-x 3 ian staff 102B Oct 15 15:06 .
drwxr-xr-x 44 ian staff 1.5K Oct 10 11:03 ..
-rw-r--r--@ 1 ian staff 6.0K Oct 15 15:06 .DS_Store
But the .
-prefixed file in the above example isn't considered "hidden". Just "not displayed in the default view". Any sort of hiding like this would necessitate you rename your files and folders so they're prefixed with a .
and then they'd also disappear by default from Finder.
As you can see from answers on other SE sub-sites (1, 2, 3), the prefix-with-a-dot is really the only consistent way to keep a file or folder out of the normal view of most shell functions and commands.
ls
output? Keep them from registering in the list of options when you tab to complete a command? Also: what shell?bash
?zsh
? As it stands there's not enough detail to answer this question well. – Ian C. Oct 21 '17 at 20:03ls
, which is why I didn't specify any commands. I don't want to write wrapper aliases or functions forls
or any other command. That approach is incomplete and full of problems. – iconoclast Oct 21 '17 at 20:07