57

How can I copy the file and folders full path in Nautilus? In the right-click context menu there is no such option provided. In file/folder property window I can only copy the folder path.

80

To quickly get a file path in Nautilus we can use the right click context entry "Copy" to copy the file path to the clipboard.

Then just "Paste" (resp. "Paste Filenames") this path from the clipboard to the other application, e.g. a text editor.

| improve this answer | |
  • Wow, this actually works, thanks for the great tip! – Gerhard Burger Dec 5 '12 at 8:58
  • 4
    Context-aware pasting, so awesome! – Alix Axel Aug 1 '13 at 17:07
  • 7
    Unfortunately in Ubuntu 12.04 this does not work flawlessly. When I paste to GNOME Terminal I get URL i.e. file:\\... (with URL encoded characters like %20 for space) instead of the ordinary path. – pabouk Aug 3 '13 at 20:03
  • 6
    @pabouk as a workaround you can drag and drop files onto the GNOME terminal. This will paste the file path instead of its URI. – Glutanimate Aug 4 '13 at 0:25
  • 2
    That was a bit too simple... thank you so much for the tips! Copying manually the name since years! – Gabriel Klein Dec 2 '16 at 15:09
24

You can use to copy folder path from Nautilus the command

Ctrl + l

| improve this answer | |
  • 1
    Great shortcut! Thanks – Likid Mar 6 at 10:39
  • also does not escape spaces so not useful for pasting into terminal – SteveSong 10 hours ago
17

Unfortunately pasting file path from Nautilus to GNOME Terminal does not work as expected. It pastes the path as an URL with URL encoded characters. For example it pastes:

 file:///etc/gconf/gconf.xml.defaults/%25gconf-tree.xml

instead of

 /etc/gconf/gconf.xml.defaults/%gconf-tree.xml

Solution with clipboard

Use the Edit > Paste Filenames function from the terminal menu which also takes care of escaping for a shell. Unfortunately this function does not have a keyboard shortcut (besides Alt+E+F) and it seems that it is not possible to set one using gconf-editor.

See also Nautilus copy file/directory path should not put "file://" prefix.

Solution with drag & drop

Dragging a file or directory from Nautilus to GNOME Terminal transfers the correctly formatted path like Edit > Paste Filenames mentioned above.

| improve this answer | |
  • This is resolved in Ubuntu 16.04. Copying a file from Nautilus to GNOME Terminal will just give the path /path/to/file, not the URL. – wisbucky Jul 26 '18 at 20:39
  • 1
    In Ubuntu 20.04 this is definitely not resolved (or the bug is back?) You get terrible gunk: x-special/nautilus-clipboardcopyfile://file. – Kvothe Nov 19 at 13:41
4

I found a solution to this. You can use Nautilus actions utility to add "Copy path" and "Copy directory path" the the context menu.

This seems to work well.

Source. Don't forget to make the .py-file executable.

| improve this answer | |
  • The other answers already said it copies as a path by default, this method is unnecessary – kiri Sep 7 '13 at 0:18
0

Nautilus does not provide this possibility.
But it should be possible to achieve this if you write a plugin for Nautilus.

| improve this answer | |
0

Since Takkat's solution seems to be broken with Nautilus version >= 3.30 (bug report), I would like to offer a workaround that creates a context menu option.

  1. Install Filemanager-Actions, and xclip:

sudo apt-get install filemanager-actions nautilus-actions xclip

  1. Run FileManager-Actions, and create a new action like so:
  • Hit button "Define a new action"
  • Name the action in the "Items list", e.g. "Copy path to clipboard"
  • Under the "Action" tab, check the two options "Display item in selection context menu", and "Display item in location context menu"
  • Under the "Command" tab, set path to "bash", and "Parameters" to

-c "realpath -z %B | xclip -selection clipboard"

  • Hit the button "save the items tree"
  • restart nautilus: "nautilus -q"
  1. Now you should be able to right click a file/folder, and see the action we just defined to copy the path
| improve this answer | |
  • this does not work with multiple file / folder selections... – linuxUser123 Mar 22 at 13:43
-1

Simply sudo apt-get install pcmanfm, open it, choose 'keep in Unity starts' and finally remove Nautilus.

The logo is the same, you won't notice the difference - except that you can now copy the path..

| improve this answer | |
  • 2
    -1 The question is, how to achieve this with Nautilus, not with a different file manager. – David Foerster Oct 20 '15 at 18:48

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.