Merge pull request #29839 from wxy/20230720.0-️-Mix-and-Match-Terminal-With-Nautilus-File-Manager-in-Linux

ATRP:published/20230720.0 ️ Mix and Match Terminal With Nautilus File Manager in Linux.md
This commit is contained in:
Xingyu.Wang 2023-08-07 16:49:39 +08:00 committed by GitHub
commit 0ea66569db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 153 additions and 139 deletions

View File

@ -0,0 +1,153 @@
[#]: subject: "Mix and Match Terminal With Nautilus File Manager in Linux"
[#]: via: "https://itsfoss.com/terminal-nautilus-combination/"
[#]: author: "Abhishek Prakash https://itsfoss.com/author/abhishek/"
[#]: collector: "lkxed"
[#]: translator: "ChatGPT"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-16071-1.html"
将 Linux 终端与 Nautilus 文件管理器结合起来
======
![][0]
> 这里有一些技巧和调整,通过将终端和文件管理器结合在一起,以节省你的时间。
Nautilus 是 GNOME 桌面环境中的图形化文件浏览器。你可以使用它来访问和管理系统中的文件和文件夹。
尽管并非所有人都喜欢使用终端来管理文件和目录,但你也可以通过终端进行文件和目录管理。
然而,你可能会遇到需要在终端和文件管理器之间切换的情况。
有多种方法可以在 Nautilus 文件管理器和终端之间进行交互。令人惊讶的是,并不是所有的 Linux 用户都知道这些方法。
例如,在 Nautilus 中,右键单击并选择“<ruby>在终端中打开<rt>Open in terminal</rt></ruby>”选项,将在终端中打开当前目录位置。
![在 Linux 中从 Nautilus 文件管理器中打开终端][1]
这只是我在本文中要与你分享的众多示例之一。
### 1、拖放获取绝对路径
如果你将文件夹或文件拖放到终端中,其绝对路径将被粘贴到终端屏幕上。
![将文件或文件夹从 Nautilus 拖放到终端会粘贴该项的绝对路径][2]
当你在文件浏览器中深入目录结构并且不想在终端中键入整个路径时,这样做很有帮助。
### 2、进入目录
这与上面看到的类似。如果你在目录结构中深入进入,并且不想为 [切换到该目录][3] 键入整个路径,这个技巧很有帮助。
在终端中键入 `cd` 命令,然后拖放以进入目录。
![在键入"cd"命令后,通过拖放将目录输入终端][5]
### 3、在编辑器中打开文件
类似地,你可以使用 Nano 或 Vim 编辑器打开文件进行 [编辑][6]。
将文件拖放到 `nano` 命令中以打开它进行编辑。
![在键入"nano"后,将需要编辑的文件拖放到终端][7]
### 4、使用 sudo 权限打开文件进行编辑
与上述相同,但这次你可以使用 `sudo` 权限打开文件进行编辑。
![使用 sudo 权限打开 sources.list 文件进行编辑][8]
### 5、拖放多个文件如果命令支持多个参数
你也可以拖放多个文件以获取它们的绝对路径。这可以与接受多个参数的命令一起使用。
例如,[diff 命令用于检查两个文件之间的差异][9]。输入 `diff`,然后拖放你想要检查差异的文件。
![通过选择文件并将其拖放为 diff 命令参数来检查两个文件的差异][10]
### 6、从文本文件复制粘贴
阅读文档并且需要在终端中运行其中提到的命令?你当然可以 [在终端中复制粘贴][11]。
然而,更快捷的方法是选中文本并将其拖放到终端。
这个技巧也适用于 [GNOME-Sushi][12] 预览。
![使用 GNOME-Sushi 从任何文件的预览中拖放一些文本][13]
### 7、从浏览器中拖放
与上述的文本文件类似,你也可以从浏览器中拖放文本。这有助于在进行教程操作时同时查看教程。
![从互联网拖放代码或网址到终端,无需复制或粘贴][14]
### 8、在 Nautilus 中嵌入终端
无法离开终端?直接将其嵌入到文件管理器中。这样,你无需单独 [打开一个终端][15]。
这里的关键是,如果你在文件浏览器中切换到另一个目录,嵌入的终端会自动切换到相应的目录。
你也可以在 Nautilus 嵌入的终端中执行大部分上述的拖放操作。例如,通过拖放 `.bashrc` 文件并使用 `grep`,在 `.bashrc` 中搜索特定文本。
![通过在嵌入的终端中拖放 .bashrc 文件并使用 grep在 bashrc 中搜索特定文本][16]
### 9、在嵌入的终端之间拖放文件标签
终端和文件管理器都支持选项卡视图。你可以在选项卡之间拖放文件。
例如,要 [检查 ISO 的 shasum 值][17],输入 `shasum` 命令,然后从另一个选项卡中拖放文件,如下所示。
![检查 ISO 的 shasum 值,输入 shasum 命令,然后从另一个选项卡中拖放文件][18]
### 更多关于 Nautilus 和终端的内容
喜欢这些技巧吗?也许你想学习更多类似的技巧。
如果你想更充分地利用 Nautilus 文件管理器,这里有一些技巧供你参考。
> **[调整你的 Nautilus 文件管理器的 13 种办法][18a]**
这里还有一些探索的终端技巧:
> **[19 个你应该掌握的基本但重要的 Linux 终端技巧][18b]**
💬 你是否了解其他将终端和文件管理器结合使用的酷炫技巧?不妨在下方的评论区与我们分享一下!
*题图MJ/ba1ee1c9-07e5-4fc8-bd2c-bde469ce095c*
--------------------------------------------------------------------------------
via: https://itsfoss.com/terminal-nautilus-combination/
作者:[Abhishek Prakash][a]
选题:[lkxed][b]
译者ChatGPT
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/abhishek/
[b]: https://github.com/lkxed/
[1]: https://itsfoss.com/content/images/2023/07/right-click-open-in-terminal.gif
[2]: https://itsfoss.com/content/images/2023/07/copies-absolute-path.gif
[3]: https://itsfoss.com/change-directories/
[4]: https://itsfoss.com/cd-command/
[5]: https://itsfoss.com/content/images/2023/07/enter-a-directory.gif
[6]: https://itsfoss.com/nano-editor-guide/
[7]: https://itsfoss.com/content/images/2023/07/edit-bashrc.gif
[8]: https://itsfoss.com/content/images/2023/07/open-sources.gif
[9]: https://linuxhandbook.com/diff-command/
[10]: https://itsfoss.com/content/images/2023/07/check-diff.gif
[11]: https://itsfoss.com/copy-paste-linux-terminal/
[12]: https://gitlab.gnome.org/GNOME/sushi
[13]: https://itsfoss.com/content/images/2023/07/from-sushi.gif
[14]: https://itsfoss.com/content/images/2023/07/drag-and-drop-code-from-internet.gif
[15]: https://itsfoss.com/open-terminal-ubuntu/
[16]: https://itsfoss.com/content/images/2023/07/embedded-terminal.gif
[17]: https://itsfoss.com/checksum-tools-guide-linux/
[18]: https://itsfoss.com/content/images/2023/07/shasum-final.gif
[18a]: https://itsfoss.com/nautilus-tips-tweaks/
[18b]: https://itsfoss.com/basic-terminal-tips-ubuntu/
[0]: https://img.linux.net.cn/data/attachment/album/202308/07/155713nuulz3b3dolrrqbc.jpg

View File

@ -1,139 +0,0 @@
[#]: subject: "Mix and Match Terminal With Nautilus File Manager in Linux"
[#]: via: "https://itsfoss.com/terminal-nautilus-combination/"
[#]: author: "Abhishek Prakash https://itsfoss.com/author/abhishek/"
[#]: collector: "lkxed"
[#]: translator: " "
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
Mix and Match Terminal With Nautilus File Manager in Linux
======
Nautilus is the graphical file browser in the GNOME desktop. You use it for accessing and managing files and folders on your system.
You can also manage files and directories from the terminal though not everyone prefers that.
However, you may encounter situations where you have to switch between the terminal and file manager.
There are various ways to interact between the Nautilus file manager and terminal. Surprisingly, not many Linux users know about them.
**_For example, in Nautilus, right-click and choose 'Open in terminal' option and you'll open the current directory location in the terminal._**
![Open terminal from Nautilus file manager in Linux][1]
That's just one of the many examples I am going to share with you in this article.
### 1. Drag and drop to get the absolute path
If you drag and drop a folder or a file to a terminal, its absolute path will be pasted on the terminal screen.
![Dragging and Dropping a File or Folder from Nautilus to Terminal will paste tha absolute path of that item][2]
This helps when you are deep inside the directory structure in the file browser and don't want to type the entire path in the terminal.
### 2. Enter a directory
It's similar to what you saw above. If you are deep inside the directory structure and don't want to type the entire path for [switching to the directory][3], this trick helps.
Type the [cd command][4] in the terminal and then drag and drop to enter into the directory.
![Enter to a directory by Drag and Drop that directory to the terminal after a "cd" command][5]
### 3. Open a file in editor
Similarly, you can open a file for [editing with Nano][6] or Vim editor.
Drag and drop a file to `nano` command to open it for editing.
![After typing "nano", drag and drop the file you need to edit to the terminal][7]
### 4. Open a file for editing with sudo
Same as above but this time, you open the file for editing with sudo access.
![Open the sources list file in nano with sudo privileges.][8]
### 5. Drag multiple files, if the command supports multiple arguments
You can also drag and drop multiple files to get their absolute paths. This can be used with commands that accept more than one argument.
For example, the [diff command checks the difference between two files][9]. Enter `diff` and then drag and drop the files you want to check for differences.
![Check the difference in two files by selecting both files and then drag and drop them as diff command arguments][10]
### 6. Copy and paste from text files
Reading a document and have to run a command mentioned in it? You can of course [copy paste in the terminal][11].
However, a quicker way is to select the text and drag and drop it to the terminal.
This trick works with [GNOME-Sushi][12] preview as well.
![Drag and Drop some text from any file from its overview using GNOME-Sushi][13]
### 7. Drag and drop from browser
Like the text files above, you can also drag and drop text from browsers. This helps in following tutorials while doing it at the same time.
![Drag and Drop codes or URLs from internet to the terminal without copy or paste][14]
### 8. Embed terminal in Nautilus
Can't live without the terminal? Embed it directly in the file manager. This way you don't have to [open a terminal][15] separately.
The thing here is that if you switch to another directory in the file browser, it automatically switches the directly in the embedded terminal also.
You can perform most of the above-mentioned drag and drop operations in the Nautilus embedded terminal also. For example, search for a specific text in bashrc, by dropping the `.bashrc` file and using grep.
![Search for a specific text in bashrc, by dropping the .bashrc file in the embedded terminal and using grep][16]
### 9. Drag files between tabs of the embedded terminal
Both terminal and file manager supports the tabbed view. You can drag and drop files from one tab to another.
For example, to [check the shasum][17] value for an ISO, enter shasum command, then, drag and drop the file from another tab, as shown below.
![Check the shasum value for an ISO, enter shasum command, then, drag and drop the file from another tab][18]
### More on Nautilus and terminal
Liked these tips? Maybe you would want to learn more such tips.
If you want to get more out of the Nautilus file manager, here are a few tips for you.
Here are some terminal tips to explore.
💬 _Do you know any other such cool tip that combines the terminal and the file manager? Why not share it with us in the comment section below?_
--------------------------------------------------------------------------------
via: https://itsfoss.com/terminal-nautilus-combination/
作者:[Abhishek Prakash][a]
选题:[lkxed][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/abhishek/
[b]: https://github.com/lkxed/
[1]: https://itsfoss.com/content/images/2023/07/right-click-open-in-terminal.gif
[2]: https://itsfoss.com/content/images/2023/07/copies-absolute-path.gif
[3]: https://itsfoss.com/change-directories/
[4]: https://itsfoss.com/cd-command/
[5]: https://itsfoss.com/content/images/2023/07/enter-a-directory.gif
[6]: https://itsfoss.com/nano-editor-guide/
[7]: https://itsfoss.com/content/images/2023/07/edit-bashrc.gif
[8]: https://itsfoss.com/content/images/2023/07/open-sources.gif
[9]: https://linuxhandbook.com/diff-command/
[10]: https://itsfoss.com/content/images/2023/07/check-diff.gif
[11]: https://itsfoss.com/copy-paste-linux-terminal/
[12]: https://gitlab.gnome.org/GNOME/sushi
[13]: https://itsfoss.com/content/images/2023/07/from-sushi.gif
[14]: https://itsfoss.com/content/images/2023/07/drag-and-drop-code-from-internet.gif
[15]: https://itsfoss.com/open-terminal-ubuntu/
[16]: https://itsfoss.com/content/images/2023/07/embedded-terminal.gif
[17]: https://itsfoss.com/checksum-tools-guide-linux/
[18]: https://itsfoss.com/content/images/2023/07/shasum-final.gif