Article Title: xclip: Manage X clipboard. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
In system X, there are two mechanisms for copying a text segment from one window to another, namely Selections and cut buffers.
Common copy & paste uses the cut buffers mechanism. In addition, you can use the mouse to select a piece of text and then press the mouse in another window to copy the text. The selections mechanism is used. Selection can be divided into master and slave selection.
When you select a file with the mouse, the text is automatically copied to the master selection. Then, press the middle mouse button in another place to automatically paste the content of the master selection.
When you want to copy a small amount of text, both methods are very convenient. However, it is difficult to copy large text segments. In addition, you may frequently perform some copy and paste operations, without stopping the mouse to select text, and then paste it. This is a torment to your fingers.
I can't stand this kind of torture, so I found xclip, a tool for managing content in X selections conveniently.
For example, run the following command to copy the/etc/passwd file to the X master selections file.
Xclip-I/etc/passwd
Then you can copy it elsewhere and use the middle mouse button. Or a more comfortable shift + insert. The most common method I use now is to manage the content of X master selections through keyboard binding. For example, alt + F1 can take my ~ /Copy f1 content to X master selections, alt + F2 copy ~ /F2 content. In this way, you can easily copy and paste the frequently used content. For example, common passwords.