0

I would like to copy a file to the clipboard with the terminal, like when right clicking a file and selecting "copy" in the gui. Someting like "cp test.txt" (without a destination) so whenever I want, I could right click and paste the file (or files) in the gui. Thank you

enter image description here

  1. No file in clipboard
  2. What I am trying to do: (copy a file to the clipboard with the terminal). Exactly like right clicking a file and selecting copy. (test.txt already on desktop)
  3. Now the file is in the clipboard and I can paste it anywhere
  4. File is pasted

Update this is exactly what I want to do only in Linux instead of Windows enter image description here

  • Possibly related: https://unix.stackexchange.com/q/268818/117549 – Jeff Schaller Jul 11 '20 at 19:12
  • No not what I'm looking for but thank you! – lordcommander Jul 11 '20 at 19:16
  • 2
    Does this answer your question? [Copy the contents of a file into the clipboard without displaying its contents](https://unix.stackexchange.com/questions/211817/copy-the-contents-of-a-file-into-the-clipboard-without-displaying-its-contents) – Andy Dalton Jul 11 '20 at 19:27
  • The bes bet is [Copy file from commandline, paste into Gnome window or vice-versa](https://unix.stackexchange.com/q/41926/306529) – Jorengarenar Jul 11 '20 at 19:28
  • @Jorengarenar Yes i actually read that and it is exactly what i'm looking for, but I didn't understand the answer... Does it work only on gnome? – lordcommander Jul 11 '20 at 19:30
  • @AndyDalton No it doesn't but thank you, What I am looking for is to copy a file from the command line and paste into the file explorer. So I will use a command to copy a file, not only the contents, and use "Ctrl v" to paste it in UI. – lordcommander Jul 11 '20 at 19:31
  • Sadly, I won' be of much more assistance as I'm not much of a GUI user – Jorengarenar Jul 11 '20 at 19:36
  • Are you trying to do half of the file copy with the command line, and half with the GUI? – ctrl-alt-delor Jul 11 '20 at 19:44
  • 2
    Does this answer your question? [Copy file from commandline, paste into Gnome window or vice-versa](https://unix.stackexchange.com/questions/41926/copy-file-from-commandline-paste-into-gnome-window-or-vice-versa) – Gilles 'SO- stop being evil' Jul 11 '20 at 19:45
  • 1
    It looks like you are trying to get the file-name (and maybe some meta data) into the clipboard. – ctrl-alt-delor Jul 11 '20 at 19:45
  • @ctrl-alt-delor "Are you trying to do half of the file copy with the command line, and half with the GUI?" Yes. – lordcommander Jul 11 '20 at 19:48
  • @Gilles'SO-stopbeingevil' yes but it seems very difficult and only in gnome, I couldn't seem to understand the answer. I'm looking for a more practical solution. His question is exactly what i'm asking though – lordcommander Jul 11 '20 at 19:49
  • @ctrl-alt-delor "It looks like you are trying to get the file-name (and maybe some meta data) into the clipboard." I think so but more like half of the file copy with the command line, and half with the GUI – lordcommander Jul 11 '20 at 19:50
  • I am confused. I read that comment 10 times. You used the "but" conjunction, and then agreed with me. Is it that you missed that I wrote the other comment (that is the sort of thing I do). Or are you trying to say something else. – ctrl-alt-delor Jul 11 '20 at 20:23
  • I have been playing: I found that `xclip-copy` or `xclip-cut` can be used for the first bit. Then `xclip-paste` can be used to do the 2nd bit. All with the CLI. I then note that this tool uses the secondary-selection (X11 as primary-selection (What you select with the mouse), secondary-selection, and clip-board). And Dolphin used the clipboard. So I then played with `xclip` and pipes to move clips from one to the other. I have had some success with this. But the `target` is not correct, so it does not work. – ctrl-alt-delor Jul 11 '20 at 20:31
  • @ctrl-alt-delor when i said "but" i was talking to "Gilles'SO-stopbeingevil" – lordcommander Jul 12 '20 at 10:56
  • @ctrl-alt-delor This is what i'm trying to do: "Are you trying to do half of the file copy with the command line, and half with the GUI?" – lordcommander Jul 12 '20 at 10:57

0 Answers0