Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OSX - always hide certain files

Tags:

terminal

macos

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?

like image 680
timkl Avatar asked Oct 30 '25 04:10

timkl


1 Answers

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.

like image 120
tegbains Avatar answered Nov 01 '25 12:11

tegbains



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!