Copy file and folder path from Nautilus

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.


You can use to copy folder path from Nautilus the command

Ctrl + l


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.

Tags:

Nautilus