Opening The Linux File Explorer From The Terminal

Cover Image for Opening The Linux File Explorer From The Terminal

As a Linux user, you may find yourself working in the terminal frequently. While the terminal is incredibly powerful for executing commands and managing files, visually browsing files and directories can sometimes be easier in a graphical file explorer.

Thankfully, Linux offers easy ways to open up the file explorer directly from the terminal.

Why Open The File Explorer From the Terminal?

There are a few key reasons why you may want to launch the graphical file explorer from the terminal:

  • Convenience - When already working in the terminal, it can be faster to type a quick command to open the explorer in a specific directory rather than navigate there through multiple clicks.

  • Access Files Quickly - You can navigate directly to a directory in the terminal and then open up its contents to visually inspect files and folders.

  • Integrate Graphical and Terminal Workflows - Using both the terminal and GUI file manager plays to the strengths of each, allowing you to work more efficiently.

Overall, directly launching the file explorer from the terminal helps unify the terminal and GUI workflows in Linux. The techniques for doing this are straightforward too.

Common Linux File Explorers

The most common graphical file explorers in Linux include:

  • Nautilus - The default file manager included with the GNOME desktop environment used in distributions like Ubuntu.

  • Dolphin - The file manager integrated with the KDE Plasma desktop used in distros like Kubuntu.

  • Thunar - A lightweight but full-featured explorer commonly added by default in Xfce-based distros.

The exact method for launching these apps varies slightly, but we'll cover the most common techniques.

Open File Explorer To Current Directory

The most basic scenario is that you simply want to open the file explorer to visually browse the current working directory in the terminal.

With Nautilus, run:

nautilus .

For Dolphin:

dolphin .

And Thunar:

thunar .

The "." means the current directory, so this will launch the explorer focused right on your present location in that terminal session.

Launch File Manager In Specific Directory

You can also directly launch the file explorer to any custom path you specify.

For example, to open your home folder in Nautilus:

nautilus ~/

Or to open the /etc directory in Dolphin:

dolphin /etc

This method lets you access key Linux directories very quickly.

Open File Manager to View a Specific File

Another variation is using the file explorer as a quick way to visually inspect a file without opening it directly into an editor.

You can pass a filename as an argument to open that file selected in the GUI:

nautilus my_notes.txt

This technique can supplement terminal commands like less, cat or head to browse files.

Set Default File Manager

By default, the xdg-open command in Linux will launch the desktop environment's preferred file manager.

So you can use xdg-open it instead of the specific name if your DE supports it:

xdg-open ~/Documents

This helps create consistency instead of remembering multiple file manager names.

Some environments also take this a step further...

Always Open Folder on Terminal Launch

In GNOME, you can configure its Terminal app to directly open the current working directory in Nautilus every time you launch a new terminal session.

To enable, go to Settings > Preferences and check "Open folder on terminal launch". Now firing up Terminal will automatically display that path in Nautilus too.

Customize With Aliases

To save additional keystrokes, consider creating custom terminal aliases if you frequently open the file explorer to common directories.

For example, add this line to your .bashrc to make an l shortcut:

alias l='nautilus ~/Downloads/'

Now typing l will instantly launch Nautilus to your Downloads folder.

Convenience With Control

Part of what makes Linux great is the ability to efficiently access files either through typing commands or clicking around in a graphical interface.

Launching your desktop's file explorer straight from an open terminal session fuses these experiences together into a very convenient hybrid workflow.

Whether you want quick visual access to files related to terminal tasks, or just like the time savings of typing paths instead of hunting through hierarchical menus, opening up GUI file managers from the command line delivers.

As Linux continues to improve support for both power users and newcomers, tools that marry these approaches will provide a friendlier on-ramp for people to leverage the flexibility of CLI environments while still being able to visually orient themselves as needed. The file manager is a perfect bridge in this regard.

So next time you're working in the terminal, don't forget about the handy launch options for GUI managers like Nautilus or Dolphin to complement your commands.


Also read -

How to Install Linux on Your Mac: A Step-by-Step Guide

Getting Started with NetworkManager on Kali Linux

Getting Kali Linux Network Manager Up and Running