I'm running Ubuntu 10.04 and I find it annoying that by default the copy/paste functionality also pastes the text format. Most of the time when I copy/paste text I only want to paste the ascii text without any formatting. Is there a way to configure that behavior?
7 Answers
I've found a way to achieve this after some searching online and experimenting with my environment.
You can create a custom shell script which you can then bind to a key shortcut in your desktop environment. I'm using Xfce on Linux Mint (which is based on Ubuntu). Xfce allows me to override Ctrl-C by simply defining that as the shortcut in Settings -> Keyboard -> Application Shortcuts, but I prefer using a different shortcut, Ctrl-Alt-C, so that I'm still able to copy with formatting in the rare cases I need to.
Here's how I did it.
Install xclip:
apt-get -y install xclip
I don't know about other desktop environments, but Xfce didn't like me using a pipe in the custom keyboard command, so I had to make a script with the xclip-line, which is then bound to my keyboard shortcut (Ctrl-Alt-C).
My personal habit is putting custom commands in ~/.bin and then adding that directory to the PATH variable.
Here's how you do that, if so inclined:
mkdir ~/.bin
echo 'export PATH=~/.bin:$PATH' >> ~/.bashrc
(Note that you will need to re-initialize your session for that change to take effect, meaning you'll have to log out of your desktop environment and back in again. See if it worked by typing echo $PATH in a terminal after having logged in again.)
I've then created the script ~/.bin/copy-without-formatting with the following content:
#!/bin/bash
xclip -o | xclip -selection clipboard
Remember to make it executable with the following line:
chmod +x ~/.bin/copy-without-formatting
Then, since I'm using Xfce, I've gone to Settings -> Keyboard -> Application Shortcuts and added a shortcut with the full path to the script, without variables or a tilde. So if my username were mrgaga, the string would be /home/mrgaga/.bin/copy-without-formatting. Then I've configured the shortcut.
Xfce activates the changes immediately when I've closed the window so you should be able to check if it works right away, without logging out and in again, at least if your environment is similar enough to mine.
I hope it helps.
- 175
- 1
- 11
To paste unformatted text using a custom keyboard shortcut in Ubuntu, you can use a clipboard manager like copyQ. Here's a step-by-step guide on how to set it up:
- Install copyQ: Open the terminal and enter the command
sudo apt-get install copyq. - Launch copyQ: Start copyQ from the Applications menu or by running the copyq command in the terminal.
- Set up a keyboard shortcut for plain-text paste:
- Click on the Edit menu, then Preferences, and select the Shortcuts tab.
- Scroll down and find the "Paste Clipboard as Plaintext" action.
- Press the desired keyboard shortcut, for example Ctrl+Shift+V, then click OK.
Now, whenever you copy formatted text, you can use your new Ctrl+Shift+V shortcut to paste it as plain text without any formatting.
Operating System: Kubuntu 24.04
CopyQ Clipboard Manager 7.1.0-10-gfbca9527
https://hluk.github.io/CopyQ/
- 698
- 10
- 28
In some places where, for some weird reason (looking at you Atlassian), ctrl+shift+v doesn't work, one could use this tool: CopyQ and then add a global shortcut to it, that overrides the paste without formatting behavior of Ubuntu (which sometimes might be forced to work in another way)
- 332
In my Ubuntu 20.04 focal (x86-64) Cinnamon 4.8.6 you can use Shift-Insert to paste text without formatting.
- 1,865

