
Recently, we showed you how to open a directory in Terminal from within Nautilus. However, what if you’re working on the command line in Terminal and need to access the same directory in Nautilus? There’s an easy solution for that.
最近,我們向您展示了如何從Nautilus中在Terminal中打開目錄。 但是,如果您在終端中的命令行上工作并且需要訪問Nautilus中的相同目錄怎么辦? 有一個簡單的解決方案。
NOTE: When we say to type something in this article and there are quotes around the text, DO NOT type the quotes, unless we specify otherwise.
注意:當我們說要在本文中鍵入某些內容并且文本周圍有引號時,請不要鍵入引號,除非我們另外指定。
To open the current directory open in Terminal, type the following command at the prompt and press Enter.
要打開在Terminal中打開的當前目錄,請在提示符下鍵入以下命令,然后按Enter。
nautilus .
鸚鵡螺。
NOTE: Be sure to type a space between “nautilus” and the period (“.”).
注意:請確保在“鸚鵡螺”和句點(“。”)之間鍵入一個空格。
It doesn’t matter which directory is active in Terminal before jumping to a specific directory in Nautilus.
跳轉到Nautilus中的特定目錄之前,在終端中處于活動狀態的目錄都沒有關系。

Nautilus opens directly to the specified directory.
Nautilus將直接打開到指定目錄。

You can easily jump to other directories in Nautilus, such as your Home directory…
您可以輕松跳轉到Nautilus中的其他目錄,例如主目錄…

…or your Music directory. You can also jump to other directories within your Home directory, such as Documents (nautilus ~/Documents), pictures (nautilus ~/Pictures), or Downloads (nautilus ~/Downloads).
…或您的音樂目錄。 您還可以跳到主目錄中的其他目錄,例如文檔(nautilus?/ Documents),圖片(nautilus?/ Pictures)或下載(nautilus?/ Downloads)。

Jumping to directories you created are just as easy. Note that for directory names that contain spaces, preface each space with a backslash (\).
跳轉到您創建的目錄同樣簡單。 請注意,對于包含空格的目錄名稱,請在每個空格前加反斜杠(\)。

If there are certain directories you access a lot, you can create aliases, or shortcuts, to access those directories in Nautilus from Terminal. For example, you can create the following alias so you can simply type “nh” to access your Home directory in Nautilus.
如果您經常訪問某些目錄,則可以創建別名或快捷方式,以從Terminal在Nautilus中訪問這些目錄。 例如,您可以創建以下別名,因此只需鍵入“ nh”即可訪問Nautilus中的主目錄。
alias nh=’nautilus .’
別名nh ='nautilus。'
See our article to learn how to create and use aliases to customize Ubuntu commands.
請參閱我們的文章,以了解如何創建和使用別名來自定義Ubuntu命令。

Then, on the command line in Terminal, you can type “nh” from any directory to jump to your Home directory in Nautilus.
然后,在終端的命令行上,可以從任何目錄鍵入“ nh”以跳轉到Nautilus中的主目錄。

To close the Terminal window, type “exit” at the prompt and press Enter, or click the X button in the upper-left corner of the window.
要關閉“終端”窗口,請在提示符下鍵入“ exit”,然后按Enter,或單擊窗口左上角的X按鈕。

You can also create a bash shell script containing the “nautilus .” command. This allows you to press Alt + F2 to access the command bar from Unity, type “nh” (or whatever filename you assigned to the script), and press Enter, to open your Home directory without ever opening a Terminal window.
您還可以創建一個包含“ nautilus”的bash shell腳本。 命令。 這樣,您可以按Alt + F2從Unity訪問命令欄,鍵入“ nh”(或您分配給腳本的任何文件名),然后按Enter鍵打開主目錄,而無需打開終端窗口。
NOTE: You can also click on the resulting icon for your script to run it.
注意:您也可以單擊腳本的結果圖標以運行它。
See our Beginner’s Guide to Shell Scripting series to learn how to create shell scripts.
請參閱我們的《 Shell腳本入門指南》系列,以了解如何創建Shell腳本。

If you’re already in Nautilus and you need to move to a different directory, you can use the keyboard to get there if you show the location entry instead of the breadcrumb bar.
如果您已經在Nautilus中,并且需要移動到其他目錄,則在顯示位置條目而不是面包屑欄時,可以使用鍵盤到達那里。
翻譯自: https://www.howtogeek.com/193071/how-to-open-the-ubuntu-nautilus-file-browser-from-the-terminal/