Mac os viewing hidden files

Как отобразить скрытые файлы в macOS за 5 секунд

Изначально операционная система Apple не позволяет пользователю видеть скрытые папки и файлы на накопителях. Сделано это для стабильной работы системы и является своеобразной защитой от начинающего пользователя.

Доступ к срытым файлам может понадобиться для редактирования системных файлов или настроек приложений, для ручной очистки системы и в ряде других случаев.

Вот три способа отобразить скрытые данные в macOS.

Для любителей приложения Терминал

Большинство настроек и системных действий на Mac можно сделать через приложение Терминал. Включение и отключение скрытых файлов и папок – не исключение.

1. Запускаем приложение Терминал из Lounchpad или Spotlight.

2. Вводим команду:

defaults write com.apple.finder AppleShowAllFiles -boolean true ; killall Finder

Finder после этого перезапустится, а скрытые файлы и папку будут видны.

Для отключения опции следует использовать такую команду:

defaults write com.apple.finder AppleShowAllFiles FALSE ; killall Finder

Для любителей скриптов

Можно создать целое приложение, которое в одно нажатие будет включать или отключать отображение скрытых файлов и папок.

1. Запускаем приложение Редактор скриптов из Lounchpad или Spotlight.

2. В строке меню выбираем Файл – Новый.

3. В открывшееся окно вставляем такой код:

set vis to do shell script “defaults read com.apple.Finder AppleShowAllFiles”

if vis = “FALSE” then

do shell script “defaults write com.apple.finder AppleShowAllFiles TRUE”

do shell script “defaults write com.apple.finder AppleShowAllFiles FALSE”

tell application “Finder” to quit

tell application “Finder” to activate

4. Остается выбрать пункт меню Файл – Сохранить и сохранить скрипт в виде приложения.

Теперь его можно поместить в Док и быстро включать или отключать отображение скрытых файлов и папок в Finder.

Самый быстрый способ

Для тех, кто не хочет возиться с редактором скриптов или терминалом, в Apple придумали сочетание клавиш.

Запоминаем шорткат: ⌘ + ⇧ +.

Одно нажатие и скрытые файлы отобразятся, еще одно и они снова станут скрытыми.

Источник

Quickly Show/Hide Hidden Files on macOS Sierra, OS X El Capitan & Yosemite

Updates

Added shortcut method available on macOS Sierra keyboard.

Method of showing/hiding hidden files tested and working on macOS Sierra.

Method of showing/hiding hidden files tested and working on Mac OS X El Capitan.

It seems like every day I search Google for the command to show hidden files on Mac OS X, not to mention Googling for the command to then hide those hidden files a few minutes later.

Today I decided to make a short and easy to remember alias to speed up the process. All I need do now is type showFiles and hideFiles whenever I need to show/hide OS X’s hidden files. Here’s how you can do it too.

The Quickest Way to Show/Hide Hidden Files

Since the release of macOS Sierra, when in Finder, it is now possible to use the shortcut:

Press once to show hidden files and again to hide them. If you’re using a version earlier than macOS Sierra, see Show/Hide Hidden Files using Terminal Aliases to setup a toggle command via terminal.

Thanks to Guido Schlabitz for making me aware of this new shortcut.

Show/Hide Hidden Files the Long Way

The long way to show hidden Mac OS X files is as follows:

  1. Open Terminal found in Finder > Applications > Utilities
  2. In Terminal, paste the following: defaults write com.apple.finder AppleShowAllFiles YES
  3. Press return
  4. Hold the ‘Option/alt’ key, then right click on the Finder icon in the dock and click Relaunch.

Relaunch Finder by right clicking the Finder Icon whilst holding the `option/alt` key

This will show all hidden files. To hide them again, follow the same steps but replace the Terminal command with:

It’s not the longest set of instructions or the biggest command to commit to memory but if you’re doing this a lot, it’s worth spending a few minutes now to save yourself a lot more time in the future.

Show/Hide Hidden Files using Terminal Aliases

A Terminal alias is a name or shortcut for one or multiple commands. Using an easy to remember alias, we can turn the above four step process into just one.

An alias can be made temporarily (just for the use of one terminal session) or permanently. As we want this to be a shortcut used now and in the future, let’s make it permanent:

  1. Open Terminal found in Finder > Applications > Utilities
  2. In Terminal, paste the following: sudo nano

/.bash_profile

  • Enter your Mac’s administration password if required, then hit return
  • At the bottom of the open .bash_profile file, paste the following: alias showFiles=’defaults write com.apple.finder AppleShowAllFiles YES; killall Finder /System/Library/CoreServices/Finder.app’

    Below that, paste the following: alias hideFiles=’defaults write com.apple.finder AppleShowAllFiles NO; killall Finder /System/Library/CoreServices/Finder.app’

  • Press ctrl + O and hit return to save the file
  • Press ctrl + X to exit the file and return to the command line
  • In Terminal, paste the following: source

    /.bash_profile to refresh your profile and make the aliases available

    Adding aliases to .bash_profile via Terminal

    Now when you want to show hidden files, all you need type in Terminal is showFiles , then hideFiles when you want to hide them.

    If you want to modify the behaviour or alias names, let’s take a closer look at the commands you just added:

    alias tells Terminal we’re adding a new alias.

    showFiles is the name of the alias. Change this to what you wish.

    We then give the alias two commands. The first being:

    This is the command to show hidden files and is ended with a semi-colon ; so we can then use the second command:

    This will relaunch the Finder (to replicate the step of holding the ‘Option/alt’ key then right clicking the Finder icon in the dock).

    Conclusion

    With the aliases set up, all you need do in the future is type showFiles and hideFiles to show and hide Mac OS X’s hidden files respectively.

    Aliases can be used to speed up your interaction with the Terminal. Set up an alias for navigating to your most used directories, to commit to a GitHub repo and so on.

    Ian Lunn is a Front-end Developer with 12 years commercial experience, author of CSS3 Foundations, and graduate of Internet Technology. He creates successful websites that are fast, easy to use, and built with best practices.

    Источник

    Show Hidden Files in Mac OS X

    Need to show hidden files on a Mac? This is pretty common if you find yourself needing to access hidden files on your Mac, like an .htaccess file you downloaded, a .bash_profile, a .svn directory, – literally anything preceded with a ‘.’ indicating it is invisible by default – you can run the below command from the terminal to set hidden files to become visible throughout Mac OS X.

    For some quick background to fill in those who don’t know, files that are hidden in Mac OS are determined so by preceding the filename with a single period symbol (.), you can actually make any file hidden by placing a period in front of the name, thus making it invisible to the Finder. Let’s walk through making all hidden files become visible in Mac OS X, regardless of what system software version is on the Mac.

    How to Show Hidden Files & Folders on Mac

    This changes the default setting of Mac OS X so that Finder always shows all files, including showing hidden files.

    1. Launch the Terminal app, found in /Applications/Utilities
    2. Enter the proper command exactly as shown below, choosing for your version of MacOS or Mac OS X:

    For showing hidden files and folders in macOS High Sierra 10.13, MacOS Sierra 10.12, OS X El Capitan 10.11, Yosemite 10.10, and OS X Mavericks 10.9, use the following command string to show hidden files:

    defaults write com.apple.finder AppleShowAllFiles TRUE;killall Finder

    For showing hidden files in Mac OS X 10.8 Mountain Lion, OS X 10.7 Lion, Mac OS X 10.6 Snow Leopard, and before, use this defaults command string instead:

    defaults write com.apple.Finder AppleShowAllFiles TRUE;killall Finder

  • Hit the Return key after the command is entered into the Terminal command prompt, that will execute the command and allow the hidden files to become visible in the file system of Mac OS
  • Here is what the defaults command string which shows hidden files looks like in the Mac Terminal:

    The Finder will refresh after you hit the Return key, which causes Finder to quit and relaunch itself for the changes to take effect, thus revealing hidden files on the Mac.

    “Hidden” files are now visible in Finder windows, but they will display as a dimmed version of their respective file icons, being slightly transparent. Examples of how hidden files show up in the Finder are shown below.

    This is how hidden files look when they’re visible in a modern version of Mac, like an macOS High Sierra, Sierra, OS X El Capitan or Yosemite Finder window, note the hidden folders and files are visible but have dimmed gray names:

    And this is how the once invisible files show in prior releases of Mac OS X, highlighted here:

    This setting stays in place until it has been reversed or disabled, which would cause all files to become hidden again just as the default. With all the files visible a Finder window can look much busier than you may be accustomed to, and it’s not always desired to leave on constantly. Thankfully it’s just as easy to switch back.

    Remember the Finder must relaunch to show hidden files and folders, they will appear as slightly translucent icons alongside the normal icons. The files and folders that are hidden typically will have a ‘.’ in front of their name, but other items can be hidden as well through chflags commands.

    If you’re having difficulty with the above commands for some reason, you can split them up into two parts like so:

    First the command to show invisible files on Mac:

    defaults write com.apple.finder AppleShowAllFiles TRUE

    Then the command to kill and relaunch Finder on Mac, which is where the invisible files will now be shown:

    Note that refreshing Finder is always necessary. This is the same in OS X El Capitan, Yosemite and old versions of Mac OS X too, the Finder must always be refreshed this way to reveal the hidden folders and files.

    * Quick note about different versions of Mac OS X: If you look carefully, you’ll notice there is a very slight difference in casing for making hidden files and folders visible in modern versions of macOS and Mac OS X versus older versions of Mac OS X system software (com.apple.finder vs com.apple.Finder). That casing is important, however, which is why you must enter exact syntax.

    Reverse to Default & Make Files Hidden Again in Mac OS X

    To hide files that are intended to be hidden again, thus going back to the default Mac settings of keeping them invisible, you can just type the following defaults command. As you can see, everything is the same except that TRUE has been switched to “FALSE”:

    defaults write com.apple.Finder AppleShowAllFiles FALSE;killall Finder

    Remember the slight difference in OS X Mavericks, El Capitan, and Yosemite has to do with capitalization:

    defaults write com.apple.finder AppleShowAllFiles FALSE;killall Finder

    Hit return, and again the command will set the file visibility change and relaunch Finder so that it can relaunch for changes to take effect.

    That’s all there is to it! The change will revert and you’ll be back to the default with hidden folders and files no longer visible in the Mac OS X Finder.

    Show Hidden Files in a Mac Open or Save Dialogue Temporarily

    Another approach to without using the above defaults command is to quickly show all hidden files in any Mac OS X Open or Save dialogue box by hitting Command+Shift+Period on the keyboard together. You will instantly see the change as once-hidden files are revealed.

    That command sequence can be used to toggle back or forth, thereby revealing and hiding the files again as needed. For many users, this keystroke is the most appropriate use for when an invisible file must be modified but there is no need to make them all visible all the time.

    Show Hidden Files & Folders on a Mac Temporarily with Terminal

    Another way to quickly see hidden files in OS X is by using the ls command within the Terminal, at the command line type the following:

    The -a flag tells the ls (list) command to show all contents, including hidden files. You then just have to specify a directory if you want to see the hidden files in it:

    This method does not effect the Finder or the visibility of hidden files outside of using the -a flag, making it a temporary measure to quickly see all contents of any directory or folder, even if the above defaults command isn’t used.

    One way to carry over the terminal to the GUI though would be to use the ‘open’ command, directed at a hidden file. Here’s an example:

    This will launch the file called “.not_visible_by_default” into the default GUI app associated with it’s file type, in this case it would be a text file and so TextEdit would open. This trick can also be used to open hidden directories into the Finder, for example with the following syntax:

    That would launch the hidden “.git” directory in a users home directory into a Finder window, without revealing all other files.

    Источник

    Читайте также:  Проигрыватель windows media не может открыть файл
    Оцените статью