My name is Philipp C. Heckel and I write about nerdy things.

Launch Nautilus in the current working directory


Office

Launch Nautilus in the current working directory


Working on the console is sometimes tiring, especially when you have to rename files. Using Nautilus is much quicker for these types of actions. The problem is, that if you’re working in a deep depth of your file tree and your path is very long, it may take you some extra seconds to open this path in the Nautilus browser. So wouldn’t it be much easier to simply type naut on the console to open Nautilus with the current working directory?

Update Feb/09

Apparently, this can be solved in a really easy way as Mads Buus suggested in the comments-section. The GNOME desktop environment ships with a tool called gnome-open, which can be used for this:

This opens Nautilus in the current working directory. Note: Don’t forget the dot after the command!

You might also want to look how to make a shortcut for this command, cmp. Mads Buus’ comment below. Thanks again for this much easier solution!

The solution

The solution is basically just a one-line command:

To make it shorter, we can just put these lines in a script called naut. You can either save the script where you like to or put it in your very own .bin-directory (which I will do here).

Make sure to add the .bin-directory to your PATH variable:

Usage of the naut-command

You can now use the naut-command in your console window (make sure to restart the console window before). Here is a small example:

Et voilĂ , the Nautilus window will pop up.

4 Comments


  1. Mads Buus

    this can be done MUCH easier with no scripting.

    Just do
    gnome-open .

    in a dir
    that will launch your default handler for a folder (which is nautilus for most users).
    I have added an alias in /etc/profile
    alias go=’gnome-open’

    so i just type ‘go’.
    It is also perfect for just launching the default action on a file, so:

    go XXX.zip will launch the file-roller, etc.


  2. Paolo

    Hello!

    the instruction
    nautilus .

    also works;

    I moved nautilus to another name (/usr/bin/nautilusmod) and created a new script /usr/bin/nautilus that way :
    ===========
    #!/bin/sh
    #nautilus modificato per farlo aprire nella directory corrente

    nautilusmod .
    ===============
    So each time nautilus is called it is executed in the current directory; there is certainly a gconf-editor setting doing the same, but gconf-editor is black magic…