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.
12 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
- 9,910
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.
- 1,495
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.pdfwill open the PDF in a PDF browser.gnome-open file.zipwill 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.
- 119,640
- 4,224
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.
- 261
- 2
- 3
You can use
nautilus PATHfor the Gnomenemo PATHfor the Cinnamoncaja PATHfor the MATEthunar PATHfor the Xfce
- 149
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 .
- 171
- 4
- 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
- 649
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
- 538
- 1
- 6
- 15