How can I copy the current path from Nautilus?

I'd say the quickest way is to press Ctrl+L, then you can copy it (Ctrl+C).

enter image description here


Ctrl+L. Very frustrating to not find an option in the View menu (which should then be clearly labeled Ctrl+L). Had to do a web search.

And then very frustrating to find that Ctrl+L doesn't toggle it back. Another web search... Drum roll... Esc

And then, how to set your preference? Web search... Have to install gconf-editor or dconf-editor or manually use a terminal command:

gsettings set org.gnome.nautilus.preferences always-use-location-entry true

http://ubuntuforums.org/showthread.php?t=1504058

Of course, this would be a little less painful if there were a 'terminal here' option in the context menu. Web search... Install nautilus-open-terminal

How do I open a terminal in the current location?

Sigh. Oversimplified interfaces are so hard to figure out. I appreciate all the helpful answers people have put on the web for us to find.


May I ask why you want the path?

If you want the path because you want to use it and navigate directly from the terminal, then you can simply install nautilus-open-terminal using synaptic.

Or

sudo apt-get install nautilus-open-terminal

After that, simply right click on any folder and use "Open in terminal"

If you simply want the path, then Ctrl + L would do just fine.


You can use a Nautilus script:

Paste

#!/bin/bash
echo -n "${PWD}" | xclip -selection clipboard

into ~/.local/share/nautilus/scripts/Copy Directory Path.

(requires that xclip is installed)

You can now right-click on a file, mouse over "Scripts", and choose "Copy Directory Path" to copy the path of the directory that contains the file. Caveat: will not work in an empty directory.

Explanation

  • echo -n "${PWD}": Echoes the current working directory (Nautilus sets the working directory of the script to the one you had open in the window from which you ran the script) without a trailing newline. Initially I considered pwd | head -c -1, since pwd includes a trailing newline, but that was two unnecessary calls to external programs compared to echo.
  • xclip -selection clipboard: xclip by default copies to the X11 "primary" clipboard, but most desktop environments use the "clipboard" clipboard for their clipboard. I can't believe I just wrote that

Navigate to the GO menu and choose Location....