8

Whenever I copy any text via X11's copy/paste feature, I would like all formatting to be removed. I waste time daily dumping the text into a terminal, then copying again.

Is this possible?

Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
cat pants
  • 753
  • 5
  • 23
  • 38
  • 2
    What kind of formatting are you refering to? Which applications are you copying from and into? Are you using the PRIMARY selection (mouse selection and middle click to paste) or the CLIPBOARD selection (Ctrl+C/Ctrl+V)? – Gilles 'SO- stop being evil' Aug 01 '15 at 22:32

3 Answers3

5

This should do it:

xclip -selection c -o | xclip -selection c
Petr Skocik
  • 28,176
  • 14
  • 81
  • 141
  • 1
    Thank you! I've been trying to figure out how to do this for so long now. I'll just bind that command to a fluxbox keyboard shortcut, and it will give me the option to remove formatting if I want! – cat pants Aug 03 '15 at 06:56
  • 1
    Is there a way to automatically run this command every time some thing copied? I tried whit the clipboard from KDE but no luck. – Den May 09 '18 at 09:07
0

This will also do it in case you have xsel instead of xclip. You may need to use the -b option on both commands if it's in your CLIPBOARD instead of your primary SELECTION (See xsel man page).

xsel | xsel

Mac users can do this with pbcopy / pbpaste.

pbpaste | pbcopy
deltaray
  • 1,301
  • 2
  • 11
  • 19
0

Ubuntu distros can do this by default with CtrlShiftV.

Stephen Kitt
  • 411,918
  • 54
  • 1,065
  • 1,164
Pound Hash
  • 268
  • 4
  • 14