The python script clip.py.gz makes it easy to use the KDE clipboard on the command line.
(In this context, the clipboard is understood to be exactly what is offered by klipper
).
Basic usage
For the following examples it is assumed that the script is available in the search path asclip
.
clip
gives the content of the clipboard. You can use the switch-i 2
to obtain historic contents, here item number2
, of the clipboard (note that-i 0
refers to the current content).clip "some text"
Put"some text"
into the clipboard.ps | clip -
Put the output of some program, hereps
, into the clipboard.
Some examples
ssh $(clip)
Connect to the server whose hostname is contained in the clipboard.clip long_file_name
Use the autocompletion of the shell to copy filenames conveniently to the clipboard.cat todo | clip -
Copy the content of files, heretodo
, to the clipboard.
Download
Link | Size | Description | Hits |
---|---|---|---|
clip.py.gz | 971 Bytes | clip for KDE4 | 1586 |
clip-kde3.py.gz | 977 Bytes | clip for KDE3 | 1272 |
To use the python script clip.py.gz as described above:
- unzip the file (
gunzip clip.py.gz
), - rename it to clip,
- give yourself execute permission (
chmod +x clip
), and - place it in a folder, which is in the search path of the shell.
KDE3 vs. KDE4
The attached clip.py.gz is usingdbus
and works for KDE4. If you are still using KDE3, you can download clip-kde3.py.gz.