
To be able to copy files from the command line and paste them in a file manager, you need to specify a correct "target atom" so the file manager recognizes the data in the clipboard, and also provide the data in correct format - luckily, in case of copying files in a file manager it's just a list of absolute filenames, each on a new line, something which is easy to generate using find command: find $ -name "*. 3 Answers Sorted by: 6 To assign the output of a command to a variable, you can use command substitution: myvar ( command ) echo 'myvar' Share Improve this answer Follow answered at 18:28 user000001 31. Then use command as follows: Task: Insert files contains into the clipboard Send data.txt contains to the clipboard, enter: cat data.txt xclips Task: Paste data from the clipboard Try to copy data using CTRL + C or middle mouse button. myfile.txt|xclip -i -selection clipboard Just press the middle click (mouse button) in an X application to paste data. If you want to copy data to the "clipboard" selection, so it can be pasted into an application with Ctrl-V, you can do cat. ENVIRONMENT DISPLAY X display to use if none is specified with the -display option. xclip -t text/html index.html Middle click in an X application supporting HTML to paste the contents of the given file as HTML. We copied to the clipboard, so, paste somewhere else with C-v (or whatever keyboard shortcut it is used to paste in the tool you are using). xclip echo 'test clipboard xclip' xclip -in -selection clipboard xsel echo 'test clipboard xsel' xsel -clipboard. xclip -o > helloworld.c Put the contents of the selection into a file. Copy stdout of a command/program to the clipboard. The text can be then pasted somewhere using middle mouse button (this is called "primary selection buffer"). Show how many selection requests (pastes) have been processed. To copy contents of a file or output of some command to clipboard use cat.
#Xclip paste to file install#
To copy some data from command line to X11 clipboard you can use xclip command, which can be installed with sudo apt-get install xclip In reality the situation is a bit more complicated because you can't do the opposite - copy a list of filenames from a text editor and paste them into file manager.

I downloaded the xclip files and followed the procedure mentioned in the INSTALL.txt file. Share Improve this answer Follow edited at 18:45 Tamara Wijsman 56. I just want to press the Paste Key to show the results.

#Xclip paste to file password#
It can also be used for copying files, as an alternative to sftp/scp, avoiding password prompts when X11 forwarding has already been setup.
#Xclip paste to file full#
The result is not file's contents but its full path. A command line interface to the X11 clipboard. A simple test: select a file in file manager, press Ctrl-C, open a text editor, press Ctrl-V. When you press Ctrl-C over a file in the file manager, the file's contents IS NOT copied to the clipboard. Make sure you are using alias xclip'xclip -selection c' or else you won't be able to paste using Ctrl + v.
