What's the command to open the file browser? I want it so that I can assign a keyboard shortcut to open a specific folder.
13 Answers
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:
nautilus --browser ~/some/directory
-
But the problem I have with
nautilus
is that it has root permissions. How can I avoid that? I don't want to accidentally delete any files.– Jon DoeOct 21, 2010 at 0:03 -
4
-
simply you can type nautilus in command text. I have done the same shorcut using Win+E for opening nautilus Mar 28, 2015 at 13:45
-
1this seems to work OK, but throws a ton of errors for me and others. Jul 26, 2016 at 19:26
-
Most of this solutions need a running instance of nautilus, which on most environments is started to show the desktop icons. If not you will get a message like
Message recipient disconnected from message bus without replying
I had to enable my desktop icons usinggsettings set org.gnome.desktop.background show-desktop-icons true
– gschadenNov 30, 2022 at 14:24
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.
-
26To update this answer: gnome-open is now called gvfs-open. If you want a desktop-agnostic command, you can also use xdg-open. Mar 21, 2015 at 5:12
-
This leaves the terminal hanging awaiting more input, so you have to kill with Ctrl-C Jul 26, 2016 at 19:18
-
1@JeffPuckettII In my experience,
gnome-open file.ext
will open a file, hand it off to another program and then exit. It does not hang awaiting for more input, at least not on my Ubuntu 14.04 box at home. Jul 27, 2016 at 20:26 -
10To update @JasonChampion's update:
gvfs-open
is now deprecated, replaced by a small shell script that callsgio open
.xdg-open
is also a wrapper script, and on most Ubuntu systems it's likely to callgio open
.gnome-open
still exists as a binary distinct fromgio
– scrussMar 24, 2018 at 13:21
As of 2018, one can use the GIO commandline tool on Gnome:
gio open some/directory
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
xdg-open $HOME/test
This would open a directory named test (for example) under your home directory.
-
1this is the better answer, compared the accepted answer. The reason is: nautlius opens a folder but it hangs the command line until you closed the opened File Explorer, but this one opens the file explorer and you can still use command line.– FranvaMar 12, 2020 at 11:19
-
1For me, this option also hangs the command line... (Ubuntu 18.04) Apr 27, 2020 at 8:50
-
1A general rule for all GUI application is: if you don't want them to hang the command line, run them in background, ie. add
&
at the end of the command. Like:nautilus --browser &
– rajJan 20, 2021 at 11:31
I put the following line in my .bashrc
:
alias opn="nautilus -s ."
Now you can open with
$ opn /path/to/folder
-
There is a command named
open
already in packagekbd
, it's linked toopenvt
. Sep 2, 2014 at 9:53 -
Working in Ubuntu 18.04 too, unlike some of the other answers here.– nonbeingJun 30, 2018 at 14:16
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 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).
Man pages for xdg-open
can be found here
Note 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 Xfce
Since I am used to explorer .
I add an alias to my linux systems.
echo 'alias explorer="gio open"' >> ~/.bashrc
On a new terminal I can:
explorer .
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.
Here's the bash version
Here's the ported to zsh version
- Using nautilus for current directory ->
nautilus ./
- Using gnome-open for current directory ->
gnome-open ./
For gnome-open you might be required to installsudo apt install libgnome2-bin
-
Someone voted it down, I can't understand why. We have to type nautilus. at a folder, we want file explorer. nautilus is installed by default with ubuntu 22.04 Jan 19 at 12:56
You can simply open using a directory in File explorer using
gio open ./ path/to/folder