26

Is there a Linux equivalent of the Windows Shift+Right-click sequence? I use this a lot on files and directories to get the 'hidden' "Copy as path" option in the pop-up menu. It saves a lot of typing (and typos) when using the command line.

I'm hoping that Linux has something similar, so I can go to the 'Files' window in a GUI (Gnome3 in my case) and just copy a file or directory location as a path and then paste it in a terminal window. This function would be especially handy in Linux given the heavy reliance on the terminal! Is this possible?

Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
MappaGnosis
  • 373
  • 1
  • 6
  • 13
  • 2
    I don't know the answer to your question to be honest, but I do know that shells have tab completion, so that you can easily avoid typos. :) – schaiba Nov 25 '13 at 19:04

1 Answers1

39

If you click 'Copy' from the right-click context menu in Nautilus (file manager in GNOME3) and paste the contents in a text field (text editor, text box, etc.), it will paste the path instead of the file itself.

Chirag Bhatia - chirag64
  • 2,720
  • 1
  • 20
  • 16
  • Works with Thunar (Xfce's file manager), too. – cjm Nov 25 '13 at 19:53
  • 5
    Also works with `nemo` (Cinnamon's file manager). – terdon Nov 25 '13 at 23:49
  • Works for me - thanks. Very obvious when you think about it, although coming from Windows that approach would try to copy the entire file or just do nothing if you tried to paste into a command-line/shell. – MappaGnosis Nov 26 '13 at 07:58
  • 1
    @terdon nemo copies it as a `file://` path, which means the encoding doesn't use bash escape – Ciprian Tomoiagă Mar 17 '16 at 13:44
  • 4
    it doesnt just paste the `path` of the file. it pastes additional information. my case: ```x-special/nautilus-clipboard copy file:///home/alexzander/Documents/preparing_for_linux.py``` and its not helpful at all when you want to paste the path into a python variable for example. – alexzander Apr 22 '21 at 08:29
  • Also works if using Control+C, not just from the context menu – Crispy Holiday Jul 19 '22 at 10:13