I know how to show and hide hidden files in the Terminal - but is there a way to hide certain files like .DS_STORE when showing hidden files? Make certain files super-hidden, so to speak?
Do something like this in your .bashrc
alias lv="ls -al | grep -v .DS_Store"
Now use lv instead of ls to see all the files (including hidden), but excluding .DS_Store.
To follow up on @ibz's answer, an alias would work fine, but you may want to make a shell script that takes parameters for a little more flexibility.
#!/bin/bash
/bin/ls $@ | grep -v .DS_Store
Create the above in ~/bin and name it lv
, chmod 755 on it, and remember to add ~/bin to your path in your .bash_profile
export PATH=~/bin:$PATH
You can also name it ls
as long as you put ~/bin first in your PATH and use the full path to /bin/ls in your script so that you don't get recursive interpretation. Whenever you want to use the real ls
, then you'll need to specify the full path.
Sorry for not making myself exactly clear, I want to make files in the Finder "super-hidden", not the ls output.
To follow up on @tvanfosson's answer, a script would work fine, but you can make it simpler by defining a function in your .bashrc. :)
function lv { ls $@ | grep -v .DS_Store; }
Use chflags
with the hidden option
ie: chflags hidden fileToHide
to hide the file from the Finde
and chflags nohidden fileToHide
to show the file
Please do keep in mind the warning in man page:
Only a limited number of utilities are chflags aware. Some of these tools include ls(1), cp(1), find(1), install(1), dump(8), and restore(8). In particular a tool which is not currently chflags aware is the pax(1) utility.
What that means is that while you won't see in the Finder or Open/Save dialog boxes, the Terminal will still see it and possibly other programs that don't respect BSD flags.