How can I make files invisible from to the shell?
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
&gt; ls

IanCsiMac:~/code/tmp
&gt; 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.