The gnome-open command will open a directory with the appropriate application, which in this case is Nautilus:
gnome-open PATH
This will open the directory /tmp using the Nautilus file browser.
gnome-open /tmp
Or:
cd /tmp
gnome-open .
I like the gnome-open command because you can use this exact same command to open a file with the appropriate application. No need to remember any funny flags. It just works.
gnome-open file.pdf will open the PDF in a PDF browser.
gnome-open file.zip will open a zip file using the Zip archive viewer.
It's also similar in name and function to the Mac OS X open command, for those of us who use Macs.
The easiest and safest way I open the file explorer from command line is with the xdg-open command, which itself often aliased as the browse command if that's more your style. xdg-open ships natively with Ubuntu.
xdg-open can also open any file or web URL, and will open it according to your computer's default application for files of that filetype.
Examples:
browse .
Opens the file explorer in my current directory.
xdg-open ~ Does the same, but my home directory.
xdg-open https://www.google.ca Launches google's homepage with your default browser (xdg-open will open it as a new tab if a browser session is already open).
The de facto way in current dabian / *buntu way is now with xdg-open see this answer which is interesting. If you're using bash shell, you may find
this script to be helpful especially if you're coming from MacOS using terminal open command.
nautilus --browser
will ensure that Nautilus is launched in browser mode even if you're normally using it in spatial mode.You can append the path you want to open to the end:
The
gnome-open
command will open a directory with the appropriate application, which in this case is Nautilus:This will open the directory
/tmp
using the Nautilus file browser.Or:
I like the
gnome-open
command because you can use this exact same command to open a file with the appropriate application. No need to remember any funny flags. It just works.gnome-open file.pdf
will open the PDF in a PDF browser.gnome-open file.zip
will open a zip file using the Zip archive viewer.It's also similar in name and function to the Mac OS X
open
command, for those of us who use Macs.As of 2018, one can use the GIO commandline tool on Gnome:
Edit: Another option is xdg-open. Also take a look at this answer for further details.
For me the safest way that is compatible with almost all environments is xdg-open
This would open a directory named test (for example) under your home directory.
I put the following line in my
.bashrc
:Now you can open with
For reference, I'm running Ubuntu Bionic 18.04.
The easiest and safest way I open the file explorer from command line is with the
xdg-open
command, which itself often aliased as thebrowse
command if that's more your style.xdg-open
ships natively with Ubuntu.xdg-open
can also open any file or web URL, and will open it according to your computer's default application for files of that filetype.Examples:
browse .
Opens the file explorer in my current directory.xdg-open ~
Does the same, but my home directory.xdg-open https://www.google.ca
Launches google's homepage with your default browser (xdg-open will open it as a new tab if a browser session is already open).Man pages for
xdg-open
can be found hereNote that the xdg-open command is not meant to be used with root priveleges.
You can use
nautilus PATH
for the Gnomenemo PATH
for the Cinnamoncaja PATH
for the MATEthunar PATH
for the XfceOn ubuntu 20.04 run:
browse ./directory_path
Since I am used to
explorer .
I add an alias to my linux systems.On a new terminal I can:
The de facto way in current dabian / *buntu way is now with
xdg-open
see this answer which is interesting. If you're using bash shell, you may find this script to be helpful especially if you're coming from MacOS using terminalopen
command.Here's the bash version
Here's the ported to zsh version