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:
1 |
gnome-open . |
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:
1 |
echo "'`pwd`'" | xargs nautilus --browser |
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).
1 2 3 |
mkdir ~/.bin echo -e '#!/bin/bash\necho "'\''`pwd`'\''" | xargs nautilus --browser' > ~/.bin/naut chmod +x ~/.bin/naut |
Make sure to add the .bin-directory to your PATH variable:
1 |
echo -e '\n# Private binaries\nexport PATH=$PATH:~/.bin' >> ~/.bashrc |
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:
1 2 |
cd "/very/long and complicated/path/to/a/very/important/directory" naut |
Et voilĂ , the Nautilus window will pop up.
Thank you!!!
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.
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…
the gnome-open as an alias is GREAT! thanks!