When I type nautilus ., it will open the current directory in Nautilus only outside of the terminal, and I can go on with whatever I want to keep doing in the terminal, without having to cancel the process first.

Now, when i create an alias like

alias open="nautilus ."

and write "open" in the terminal, Nautilus will open as expected in the current directory, but it will also open in the terminal ("Initializing nautilus-dropbox 2019.02.14"), meaning I can't use the terminal until I cancel this process. Cancelling the process however will also close nautilus.

How can I prevent this?


2 Answers 2


tl;dr: Use xdg-open . instead of nautilus . (both manually and in aliases) to open Nautilus.

The precise effect of running nautilus in the terminal depends on factors that include whether or not nautilus is already running. When you start an instance of nautilus from the terminal and it detects an existing instance, it tells that instance what to do and quits; when it doesn't, it keeps running. You can use xdg-open instead, which is usually the best way to open a file or directory in a graphical program, and which quits immediately whether or not an instance of the program was already running.

To open a graphical file browser window for the current directory, you can use:

xdg-open .

That command causes . (the current directory) to be opened by whatever program is configured to handle directories. The command itself immediately terminates. If your desktop environment uses Nautilus as its file browser, then the effect is to open it in Nautilus.

If you're using a desktop environment that doesn't use Nautilus as its file browser--or if you've manually reconfigured what graphical program is responsible for opening directories--then typically you would want that other program to run instead, anyway. For example, Xubuntu uses Thunar as its file browser, and running xdg-open . in an Xubuntu session opens the current directory in Thunar, which is what you would probably want in that situation.

The directory you open doesn't have to be .. For example, xdg-open ~/Downloads opens your downloads folder.

The xdg-open command can also be used to open things that are not directories. For example, if you have a LibreOffice Writer document notes.odt, then xdg-open notes.odt will open that in LibreOffice Writer.

In my experience, most of the time one considers running nautilus some-directory, what one wants is exactly the effect produced by xdg-open some-directory.

If you want a Bash alias for this--that is, specifically to open the current directory--you can still make one:

alias open='xdg-open .'
  • 1
    xdg-open is a great command to learn! Commented Oct 19, 2019 at 17:25

You can simply call nautilus . & instead.

  • On my system the & to send nautilus to background isn't necessary. It does that automatically anyway. Ubuntu 16.04.6 LTS. Commented Oct 19, 2019 at 17:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .