82

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.

99

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 Doe Oct 21 '10 at 0:03
  • 4
    It shouldn't have root permissions unless you launch it with gksudo. – mgunes Oct 21 '10 at 0:11
  • simply you can type nautilus in command text. I have done the same shorcut using Win+E for opening nautilus – Amit Rane Mar 28 '15 at 13:45
  • 1
    this seems to work OK, but throws a ton of errors for me and others. – Jeff Puckett Jul 26 '16 at 19:26
55

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.

  • 13
    To update this answer: gnome-open is now called gvfs-open. If you want a desktop-agnostic command, you can also use xdg-open. – Jason Champion Mar 21 '15 at 5:12
  • This leaves the terminal hanging awaiting more input, so you have to kill with Ctrl-C – Jeff Puckett Jul 26 '16 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. – Stefan Lasiewski Jul 27 '16 at 20:26
  • 4
    To update @JasonChampion's update: gvfs-open is now deprecated, replaced by a small shell script that calls gio open. xdg-open is also a wrapper script, and on most Ubuntu systems it's likely to call gio open. gnome-open still exists as a binary distinct from gio – scruss Mar 24 '18 at 13:21
20

As of 2018, one can use the GIO commandline tool on Gnome:

gio open some/directory
  • 1
    Excellent, works great in 18.04, thanks! – Alz May 20 '18 at 13:30
9

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 package kbd, it's linked to openvt. – Volker Siegel Sep 2 '14 at 9:53
  • Working in Ubuntu 18.04 too, unlike some of the other answers here. – nonbeing Jun 30 '18 at 14:16
  • cool answer. it helps to create the shortcut. – mireille raad Aug 13 '19 at 21:29
7

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.

3

You can use

  • nautilus PATH for the Gnome
  • nemo PATH for the Cinnamon
  • caja PATH for the MATE
  • thunar PATH for the Xfce
3

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.

0

Use nautilus

For root file browsing, it's gksudo nautilus.

0
  1. Using nautilus for current directory -> nautilus ./
  2. Using gnome-open for current directory -> gnome-open ./
    For gnome-open if might be required to install sudo apt install libgnome2-bin

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.