mac 查看文件夹隐藏文件
Doing stuff on a Mac is supposed to be so easy and intuitive, that it’s surprising when something isn’t. There are several ways to “hide” stuff on a Mac, but only one of them really works well enough for us to recommend.
在Mac上执行操作被认为是如此简单和直观,以至于当某些事情不发生时令人惊讶。 有几种方法可以“隐藏” Mac上的内容,但只有其中一种确实可以很好地推荐给我们。
It’s not even about hiding stuff so others can’t see it. Sometimes you may simply want to hide something because you want to declutter your system. For example, if you move your Windows documents to the cloud, you will notice that many applications will often use your Documents folder for saving. Games too will often create their own folders in Documents.
这甚至不是要隐藏东西,以便其他人看不到它。 有时您可能只是想隐藏某些东西,因为您希望使系统混乱。 例如,如果将Windows文档移到云中,您会注意到许多应用程序经常会使用“文档”文件夹进行保存。 游戏也经常会在文档中创建自己的文件夹。
The problem is that soon your Documents folder can become cluttered with all these new folders. If you’re using Windows, you can easily hide stuff using folder preferences.
问题在于所有这些新文件夹很快会使您的Documents文件夹变得混乱。 如果您使用的是Windows,则可以使用文件夹首选项轻松隐藏内容。
With OS X, it isn’t so easy (every operating system has a way to do it), and it might not be such an issue for a lot of users, but eventually there may come a time when you can’t delete a folder or file, but you also don’t want to see it.
使用OS X并不是那么容易(每个操作系统都有一种方法),并且对于许多用户而言,这可能不是一个问题,但是最终可能会有一段时间您无法删除文件夹或文件,但您也不想看到它。
命令行,带走他们! (Command Line, Take Them Away!)
To hide stuff on OS X, the best method is to use the Terminal, which can be accessed by either double-clicking it from Applications, or using Spotlight, which is ideally suited for launching apps that aren’t pinned to your Dock.
要在OS X上隐藏内容,最好的方法是使用终端,可以从“应用程序”中双击它,也可以使用Spotlight(最适合启动不固定在Dock上的应用程序)来访问它。
With our Terminal open, we use a single command and some dragging-and-dropping to hide whatever we want out of view.
在打开终端的情况下,我们使用一个命令和一些拖放操作将想要隐藏的内容隐藏起来。
Here’s our Documents folder on OneDrive as seen in OS X’s Finder.
这是在OS X的Finder中可以看到的OneDrive上的Documents文件夹。
You remember that earlier Windows screenshot? All we needed to do to clean up this folder was to hide everything we didn’t want to see with a simple right-click.
您还记得以前的Windows屏幕截图吗? 清理此文件夹所需要做的就是用简单的右键单击隐藏所有我们不想看到的内容。
OS X doesn’t have that capability, and we can’t move these things because it might mess stuff up on our Windows machines because it’s synced to the cloud.
OS X不具备此功能,我们无法移动这些东西,因为它已同步到云中,因此可能会弄乱我们Windows机器上的东西。
Returning to our Terminal window, we type the command “chflags hidden ” just like it is in the quotes. Make sure you add the space to the end; it’s important for what we’re about to do. Go the to the location where you want to hide stuff, hold down the “Command” key and click to select all the files and folders you want to hide. Once you’re finished, simply drag them into the Terminal window.
返回“终端”窗口,就像在引号中一样键入“ chflags hidden”命令。 确保在末尾添加空格; 这对于我们要做的事情很重要。 转到要隐藏内容的位置,按住“ Command”键,然后单击以选中所有要隐藏的文件和文件夹。 完成后,只需将它们拖到“终端”窗口中即可。
The command prompt will paste all the locations you just dragged behind the chflags command. Here’s an example of what that might look like. All you do now is hit “Return” and everything will disappear.
命令提示符会将所有您刚才拖动的位置粘贴到chflags命令后面。 这是一个可能看起来像的例子。 您现在所要做的就是单击“返回”,所有内容都将消失。
This saves you a ton of time and typing because you don’t have to enter in each location and file by hand, and you also can hide a bunch of stuff at once.
因为您不必手动输入每个位置和文件,所以可以节省大量时间和打字时间,而且您还可以一次隐藏一堆东西。
The end result is a much nicer and cleaner Documents folder, similar to what we created in Windows File Explorer.
最终结果是一个更好,更干净的Documents文件夹,类似于我们在Windows File Explorer中创建的文件夹。
撤消您刚刚所做的事情 (Undoing What You Just Did)
Undoing all this isn’t quite as easy, because when you open your folder, the stuff you have hidden won’t show. Again, in File Explorer, it’s a great deal easier to show hidden items.
取消所有操作并不容易,因为打开文件夹时,隐藏的内容将不会显示。 同样,在文件资源管理器中,显示隐藏的项目要容易得多。
Nevertheless, open your OS X Terminal again, but this time navigate to the root folder where all your hidden stuff resides. In our example, it’s in our Documents folder, which is on our OneDrive.
不过,再次打开OS X Terminal,但这一次导航到所有隐藏内容所在的根文件夹。 在我们的示例中,它位于OneDrive上的Documents文件夹中。
We use the change directory (cd) command where, after “cd” you’d insert the path where you want to go. Again, you don’t have to type the path, you can simply drag the location over to Terminal. Just remember to add the space after “cd. ”
我们使用更改目录(cd)命令,在其中,在“ cd”之后插入您要转到的路径。 同样,您不必键入路径,只需将位置拖动到终端即可。 只要记住在“ cd”之后添加空格即可。 ”
Once you’ve changed directories, type the “ls” command to list everything in the directory, and then use the “chflags nohidden” command. Stuff with spaces between words is denoted with a “\” such as “Microsoft\ Hardware” or “Custom\ Office\ Templates.”
更改目录后,键入“ ls”命令以列出目录中的所有内容,然后使用“ chflags nohidden”命令。 单词之间带有空格的东西用“ \”表示,例如“ Microsoft \ Hardware”或“ Custom \ Office \ Templates”。
If you’ve ever used the Terminal, then you might know you don’t have to retype commands over and over. You can actually recycle command by using the up and down arrow keys. This is really convenient if you have a command or commands you need to execute over and over, but don’t want to type and type and type.
如果您曾经使用过Terminal,那么您可能知道不必一遍又一遍地键入命令。 实际上,您可以使用向上和向下箭头键来回收命令。 如果您有一个或多个命令需要反复执行,但又不想键入,键入和键入,这真的很方便。
So, there you have it, hiding and unhiding folders and files in OS X. While it’s not exactly the most elegant method, it gets the job done.
因此,您可以在OS X中隐藏和取消隐藏文件夹和文件。虽然这并不是最优雅的方法,但它可以完成工作。
Have another method or tips you would like share with us? Please, talk to us in our discussion forum.
您还有其他想与我们分享的方法或技巧吗? 请在我们的论坛中与我们交谈。
翻译自: https://www.howtogeek.com/201148/the-easiest-way-to-hide-files-and-folders-on-a-mac/
mac 查看文件夹隐藏文件