1

I have various folders with custom icons (some added by Resilio Sync, and some by other things) which drive me crazy in the terminal. Is there any way to hide them from the shell?

I know how to hide them from the Finder, and that's not what I'm asking about. Deleting them is also not what I'm asking about.

Is there any way to make them invisible to the shell?

nohillside
  • 100,768
iconoclast
  • 9,739
  • 1
    Let’s discuss voting on [meta] - keep in mind - many people down vote as unclear just because there are “edit / update” in the post rather than editing things inline. Just be clear and to the point and be ready for the answer “no - you can’t hide a file from the command line shell other than ACL to prevent seeing the directory that contains the file” – bmike Oct 21 '17 at 19:54
  • @bmike: it's extremely clear and to-the-point (other than all the extra stuff needed to try to prevent people from carelessly marking it as a duplicate). I'm ready for an answer like that if anyone can back it up with either sound reasoning or a legitimate source. Replies to the effect of "I've never seen a way to do that" are better as comments than answers. – iconoclast Oct 21 '17 at 19:58
  • Can you clarify what you mean when you say "hide them from the shell"? Hide them from 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:03
  • @IanC. When I composed the question I thought there might be an Apple-only solution that would hide from all shells, in the same way that there is a method of hiding from the Finder. My priorities are Zsh and Bash, but I'm open to hearing about any shells, if there are shell-specific solutions. And I would like it to apply to all commands, not just ls, which is why I didn't specify any commands. I don't want to write wrapper aliases or functions for ls or any other command. That approach is incomplete and full of problems. – iconoclast Oct 21 '17 at 20:07
  • There is no mention of any dupe here right now, the question is clear is at is. – nohillside Oct 21 '17 at 20:09
  • @patrix If that's true, then this is a bug in SE, cause I clearly see the duplicate banner. I can send a screenshot if you want. – iconoclast Oct 21 '17 at 20:12
  • Reload the page first. If the duplicate banner still shows, yes, I would be interested in seeing a screenshot. – nohillside Oct 21 '17 at 20:16
  • I reloaded it many times, and the banner remained. After waiting, it has gone away, but I can still send the screenshot if you're interested – iconoclast Oct 21 '17 at 20:22
  • The only thing I see is that there was a comment and a dup flag. The comment got deleted nearly an hour ago, the flag got cleared in the meantime as well. So I'm curious what exactly your screenshot says. – nohillside Oct 21 '17 at 20:40

1 Answers1

2

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.

Ian C.
  • 45,969
  • Agreed. You can keep someone out of a directory with ACL or traditional Unix permissions. That’s the gatekeeper on hiding the existence of a file from the shell. – bmike Oct 21 '17 at 23:02