0

In windows, I could right click something and copy it's path, not the actual file. Is there a Linux (Fedora) equivalent? This could be something like copying the file's path to clipboard. I googled it, but could only come up with highly technical things to do with pwd in terminal. I'm looking for a way to do this from the gui.

3
  • do you mean on the shell or using some UI? (which UI)?
    – Harry
    Dec 16, 2018 at 17:59
  • "From the GUI" – Do you mean "from the file manager"? So which file manager do you use? // "To clipboard" – Which clipboard manager? Dec 16, 2018 at 18:01
  • From gnome-files in gonme 3.0 Dec 16, 2018 at 18:02

2 Answers 2

0

The normal copy option (from the keyboard or the context menu) (at least for Nautilus) copies the file path as text, in addition to separate data that references the file as a file (as opposed to a string).

The clipboard can contain multiple pieces of data, with a mime-type, in a specific order. When reading the clipboard, applications paste the piece, or pieces, of data they can handle/prefer.

Nautilus, for example, copies some data that references the file, with the mime-type x-special/nautilus-clipboard, but also copies the file path as text in a second section. A lot of file managers will only copy a file if they see a special mime-type, and not if it is just text/plain on the clipboard.

And some file managers may not copy to the actual clipboard, but to an internal clipboard, or not copy as text, only a special datatype.

And some programs won't properly handle the mimetype, and end up pasting the file-reference data instead of the text/plain data.

2
  • I get "x-special/nautilus-clipboard" which is supposedly the clipboard manager? Dec 16, 2018 at 18:05
  • how does it copy the path? Dec 16, 2018 at 18:23
0

Enlarging on @tutacat's answer: Using most file browsers, such as Nautilus or Dolphin, after you right-click a file or directory and Copy, you can then paste (CtrlV) the full path as text directly into a text editor (e.g. gedit, similar Notepad, or Kate, comparable to Notepad++).

Had you pasted into another folder, the file itself would have been copied. It's nice having an OS with the intelligence to know whether you wanted the path or the file.

[Should the original author above wish to make his answer more complete, I'll be glad to delete this explication.]

3
  • Okay, thanks a lot, but is there a way to get only the path? Right now it gives me: "x-special/nautilus-clipboard copy file:///home/user/Desktop" Dec 17, 2018 at 5:13
  • Sure: click on the containing folder, not the file inside. Dec 17, 2018 at 23:06
  • That's what I had done... doesn't help. Dec 28, 2018 at 11:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .