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/