1. 程式人生 > 實用技巧 >mac 檢視資料夾隱藏檔案_在Mac上隱藏檔案和資料夾的最簡單方法

mac 檢視資料夾隱藏檔案_在Mac上隱藏檔案和資料夾的最簡單方法

mac 檢視資料夾隱藏檔案

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 clutteredwith all these new folders. If you’re using Windows, you can easily hide stuff using folderpreferences.

問題在於所有這些新資料夾很快會使您的Documents資料夾變得混亂。 如果您使用的是Windows,則可以使用資料夾首選項輕鬆隱藏內容。

Windows folders: Now you see ’em … now you don’t.
Windows資料夾:現在您看到'em…現在您沒有。

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’tdelete 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-clickingit 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.

在開啟終端的情況下,我們使用一個命令和一些拖放操作將想要隱藏的內容隱藏起來。

11_3_14__3_55_PM

Here’s our Documents folder on OneDrive as seen in OS X’s Finder.

這是在OS X的Finder中可以看到的OneDrive上的Documents資料夾。

11_3_14__3_45_PM

You rememberthatearlier 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 enterin 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 createdin 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 檢視資料夾隱藏檔案