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.
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.
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, this trick helps.
Type the cd command in the terminal and then drag and drop to enter into the directory.
3. Open a file in editor
Similarly, you can open a file for editing with Nano or Vim editor.
Drag and drop a file to
nano command to open it for editing.
4. Open a file for editing with sudo
Same as above but this time, you open the file for editing with sudo access.
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. Enter
diff and then drag and drop the files you want to check for differences.
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.
However, a quicker way is to select the text and drag and drop it to the terminal.
This trick works with GNOME-Sushi preview as well.
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.
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 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.
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 value for an ISO, enter shasum command, then, drag and drop the file from another tab, as shown below.
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?