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.
112 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 4 The gnome-open command will open a directory with the appropriate application, which in this case is Nautilus:
gnome-open PATHThis will open the directory /tmp using the Nautilus file browser.
gnome-open /tmpOr:
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.
As of 2018, one can use the GIO commandline tool on Gnome:
gio open some/directoryEdit: Another option is xdg-open. Also take a look at this answer for further details.
1For me the safest way that is compatible with almost all environments is xdg-open
xdg-open $HOME/testThis would open a directory named test (for example) under your home directory.
3I put the following line in my .bashrc:
alias opn="nautilus -s ."Now you can open with
$ opn /path/to/folder 2 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 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 PATHfor the Gnomenemo PATHfor the Cinnamoncaja PATHfor the MATEthunar PATHfor the Xfce
On ubuntu 20.04 run: browse ./directory_path
Since I am used to explorer . I add an alias to my linux systems.
echo 'alias explorer="gio open"' >> ~/.bashrcOn 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
Use nautilus
For root file browsing, it's gksudo nautilus.
- Using nautilus for current directory ->
nautilus ./ - Using gnome-open for current directory ->
gnome-open ./
For gnome-open if might be required to installsudo apt install libgnome2-bin