http://wiki.ljackson.us/index.php?title=Finder&action=history&feed=atom Finder - Revision history 2024-03-28T13:07:28Z Revision history for this page on the wiki MediaWiki 1.7.1 http://wiki.ljackson.us/index.php?title=Finder&diff=3500&oldid=prev Ljackson: /* Show Hidden Files */ 2018-10-14T23:05:39Z <p><span class="autocomment">Show Hidden Files</span></p> <table border='0' width='98%' cellpadding='0' cellspacing='4' style="background-color: white;"> <tr> <td colspan='2' width='50%' align='center' style="background-color: white;">←Older revision</td> <td colspan='2' width='50%' align='center' style="background-color: white;">Revision as of 23:05, 14 October 2018</td> </tr> <tr><td colspan="2" align="left"><strong>Line 6:</strong></td> <td colspan="2" align="left"><strong>Line 6:</strong></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">Open Terminal from the Utilities folder in Applications, or by searching for it using Spotlight. You can also use the Go menu in the Finder to go directly to the Utilities folder.</td><td> </td><td style="background: #eee; font-size: smaller;">Open Terminal from the Utilities folder in Applications, or by searching for it using Spotlight. You can also use the Go menu in the Finder to go directly to the Utilities folder.</td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;">Type, or copy and paste, this command: defaults write com.apple.Finder AppleShowAllFiles true</td><td>+</td><td style="background: #cfc; font-size: smaller;">Type, or copy and paste, this command: </td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">&#160;</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"><span style="color: red; font-weight: bold;"> </span>defaults write com.apple.Finder AppleShowAllFiles true</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">&#160;</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">Press Return</td><td> </td><td style="background: #eee; font-size: smaller;">Press Return</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">Type: killall Finder</td><td> </td><td style="background: #eee; font-size: smaller;">Type: killall Finder</td></tr> </table> Ljackson http://wiki.ljackson.us/index.php?title=Finder&diff=3499&oldid=prev Ljackson at 23:04, 14 October 2018 2018-10-14T23:04:34Z <p></p> <p><b>New page</b></p><div>=== Show Hidden Files ===<br /> <br /> '''How to make OS X show hidden files using Terminal'''<br /> <br /> If you’re feeling particularly adventurous, you can use the Terminal command line interface to view hidden files and folders. Here’s how to do it:<br /> <br /> Open Terminal from the Utilities folder in Applications, or by searching for it using Spotlight. You can also use the Go menu in the Finder to go directly to the Utilities folder.<br /> Type, or copy and paste, this command: defaults write com.apple.Finder AppleShowAllFiles true<br /> Press Return<br /> Type: killall Finder<br /> <br /> '''How to hide any file or folder using Terminal'''<br /> Now that you know how to view hidden files and folders on your Mac, you may be wondering how you can hide other files or folders, to keep them away from prying eyes. There are a number of third-party applications and utilities that offer to do this for you, but you can do it yourself in Terminal, like this:<br /> <br /> Launch Terminal.<br /> Type: chflags hidden<br /> Press the spacebar.<br /> Drag the file or folder you want to hide from the Finder onto the Terminal window.<br /> You’ll see the path to the file or folder displayed in Terminal after the command you typed.<br /> Hit Return to execute the command.<br /> The file or folder you dragged onto the Terminal window will now be hidden. To see it again, use one of the methods described above to see hidden files.<br /> <br /> To make the file visible permanently again, use the steps above, but in step 2 type: chflags nohidden<br /> <br /> <br /> '''Tell if a folder/file is hidden in Mac OS X'''<br /> <br /> &lt;pre&gt;<br /> <br /> 10<br /> down vote<br /> accepted<br /> According to the ls man page, you should be able -O option combined with the -l option to view flags with ls. For example:<br /> <br /> ls -Ol foo.txt<br /> -rw-r--r-- 1 harry staff - 0 18 Aug 19:11 foo.txt<br /> chflags hidden foo.txt<br /> ls -Ol foo.txt<br /> -rw-r--r-- 1 harry staff hidden 0 18 Aug 19:11 foo.txt<br /> chflags nohidden foo.txt<br /> ls -Ol foo.txt<br /> -rw-r--r-- 1 harry staff - 0 18 Aug 19:11 foo.txt<br /> Edit: Just to give a more specific solution to what the OP wanted (see comments below): To see if a folder is hidden or not, we can pass the -a option to ls to view the folder itself. We can then pipe the output into sed -n 2p (thanks Stack Overflow) to get the required line of that output. An example:<br /> <br /> mkdir foo<br /> chflags hidden foo<br /> ls -aOl foo | sed -n 2p<br /> drwxr-xr-x@ 2 harry staff hidden 68 18 Aug 19:11 .<br /> Edit 2: For a command that should work regardless of whether it's a file or a folder, we need to do something slightly more hacky.<br /> <br /> The needed line of output from ls -al varies depending on whether the thing is a file or folder, as folders show a total count, whereas files do not. To get around this, we can grep for the character r. This should be in ~all of all files/folders (nearly all should have at least one read permission), but not in the totals line.<br /> <br /> As the line we want to get then becomes the first line, we can use head -n 1 to get the first line (alternative, if you prefer sed, sed -n 1p could be used).<br /> <br /> So, for example with a directory:<br /> <br /> mkdir foo<br /> chflags hidden foo<br /> ls -aOl foo | grep r | head -n 1<br /> drwxr-xr-x@ 2 harry staff hidden 68 18 Aug 19:11 .<br /> and with a file:<br /> <br /> touch foo.txt<br /> chflags hidden foo.txt<br /> ls -aOl foo.txt | grep r | head -n 1<br /> -rw-r--r-- 1 harry staff hidden 0 18 Aug 19:11 foo.txt<br /> Edit 3: See Tyilo's answer below for a nicer way than grepping for r :)<br /> &lt;/pre&gt;<br /> <br /> === Sources ===<br /> <br /> * https://unix.stackexchange.com/questions/18973/tell-if-a-folder-file-is-hidden-in-mac-os-x<br /> * https://macpaw.com/how-to/show-hidden-files-on-mac</div> Ljackson