Linux: Set F2 F3 F4 to Cut Copy Paste

By Xah Lee. Date: . Last updated: .

This page shows you how to set {F2, F3, F4} keys to do {Cut, Copy, Paste} globally.

xvkbd is a virtual keyboard for X window system. It is useful as a shell command tool to send keys.

xbindkeys is a tool to let you bind keys to shell commands.

# install xvkbd
sudo apt-get install xvkbd
# install xbindkeys
sudo apt-get install xbindkeys

Xbindkeys Config File

Create a file at

~/.xbindkeysrc

Add the following content:

# ~/.xbindkeysrc

# make F2 do Ctrl+x
"xvkbd -no-jump-pointer -xsendevent -text '\Cx'"
F2

# make F3 do Ctrl+c
"xvkbd -no-jump-pointer -xsendevent -text '\Cc'"
F3

# make F4 do Ctrl+v
"xvkbd -no-jump-pointer -xsendevent -text '\Cv'"
F4

# make F11 do Ctrl+PageUp
"xvkbd -no-jump-pointer -xsendevent -text '\C\[Prior]'"
F11

# make F12 do Ctrl+PageDown
"xvkbd -no-jump-pointer -xsendevent -text '\C\[Next]'"
F12

# make F14 do Ctrl+w
"xvkbd -no-jump-pointer -xsendevent -text '\Cw'"
F14

Reload the Config File

Now, reload the config file.

# make xbindkeys reload config
killall -s1 xbindkeys

in case you need to restart it, do:

# restart xbindkeys daemon
killall xbindkeys
xbindkeys -f ~/.xbindkeysrc

xbindkeys tutorial

Linux: xbindkeys Tutorial

xvkbd tutorial

Linux: xvkbd tutorial

(thanks to XueFuqiao for help.)

Linux Keybinding Topic

  1. Linux: Keyboard Software Guide
  2. Linux: Swap Control Alt Keys, xmodmap
  3. Linux: Set F2 F3 F4 to Cut Copy Paste
  4. Linux: Swap CapsLock Escape Keys
  5. Linux: Make CapsLock Do Home Key
  6. Linux: Setup Shift Lock Key
  7. Linux: Add Keyboard Shortcut to Switch App
  8. Linux: Set Key Repeat Rate
  9. Linux: Set System Keyboard Layout
  10. Linux: How to Switch to Dvorak Keyboard Layout
  11. Linux: Change Volume by Command
  12. Linux: xmodmap Tutorial
  13. Linux: xbindkeys Tutorial
  14. Linux: xvkbd tutorial
  15. Linux: Find Keyboard Key Scancode
  16. Linux: X11 Keyboard Key Names