I am looking for a program that runs on Ubuntu 12.04+ x86_64 which allows pasting pre-defined text based on hotkey combinations. For instance:

Ctrl+Alt+V+U: pastes my username

Ctrl+Alt+V+E: pastes my email

Any suggestions?

  • Pastes into which program?
    – user25656
    Commented Apr 12, 2013 at 7:30
  • web browser, note pad, terminal, wine....
    – Max
    Commented Apr 12, 2013 at 7:35

2 Answers 2


You can use autokey.

Follow the instructions below:

  • Installation

    Open a terminal (Ctrl+Alt+T) and run the following command:

sudo apt-get install autokey-gtk
  • Adding Phrases

    • Open autokey using the dash.
    • In the window, expand My Phrases.

      autokey already comes with four phrases as you can see in the screenshot below.

    autokey default window

    • You can either modify the existing phrases or make a new phrase using New button.
  • Configuring Shortcut Keys

    • Click on a any phrase name to see the current configuration. In the screenshot above, First phrase is selected.

    • To change the shortcut key or Hotkey, click on Set besides the Hotkey and then click on Press to set in the new dialog box that appears.

    autokey set hotkey

    Then press the key combination you wish and select OK.

  • Configuring Window Filter

    • If you wish to use the hotkey only for a particular window, you can set Window Filter by selecting Set > Detect Window Properties and then clicking on the window.

    • Or if you would like the hotkey to work in all the windows, Clear the Window Filter.

    • Save the current phrase and Run the current script by clicking on the play-like button on the top write of the window.

    autokey window

  • Using the new shortcuts

    • You can close the autokey window and use the Hotkey to paste the corresponding phrase.

Further Information: Autokey Wiki

  • 7
    Autokey seems not to be working in 16.04 LTS, sadly.
    – Dɑvïd
    Commented Jan 25, 2017 at 13:23
  • 1
    Doesn't work when the text is in non-latin language
    – Anwar
    Commented Jul 25, 2018 at 15:47
  • 1
    It works on 18.04 LTS. Link.
    – Roald
    Commented Feb 3, 2019 at 11:18
  • Not working in 19.10, either. I can get the prompt before pasting to come up, but nothing ever pastes.
    – fivedogit
    Commented Apr 6, 2020 at 13:31
  • Whether it works does not depend on anyones Ubuntu version but whether you are using x11 (works) or wayland (unsupported). Check echo $XDG_SESSION_TYPE to know which you are currently using.
    – dreua
    Commented Jun 28, 2023 at 16:32

Since Autokey is defunct, here is how I accomplished this.
First install xclip and xdotool:

sudo apt-get install xclip xdotool

Now write the text you want to paste and save it in a text file. In this example I wrote my address in a file I called address.

Now write the bash script:

xclip -in -selection c ~/scripts/xclip-scripts/address
sleep 0.5 
xdotool key ctrl+v

xclip -in -selection c tells xclip to copy the contents of the file you saved. In this example, that file is at ~/scripts/xclip-scripts/address.

The sleep command simply allows enough time for xclip to finish copying before xdotool starts trying to paste the text.

The xdotool command actually does the pasting of the text that xclip copied from your text file.

Save your script and make it executable.

chmod +x /path/to/your/script/<script_name>

The last step is to bind a shortcut key to your script. In Ubuntu this can be set by going to System Settings/Keyboard/Shortcuts and create a custom shortcut.


  • Note that for the shortcut you have to click on the string "Deactivated", the line is not enough since that only opens the dialog "Custom Shortcut".
    – Michael S.
    Commented Mar 5, 2017 at 7:19
  • 8
    xdotool type --clearmodifiers '[email protected]' Commented Jan 23, 2018 at 13:13
  • @DmitrySandalov this sort of works, but it makes my ctrl key stuck when it's bound to hotkey ctrl + 0. any reason why? i'm on ubuntu 22.04.4
    – jellz77
    Commented Apr 8 at 15:34
  • the main answer is confirmed working in 22.04.4. just using xdotool type seems buggy
    – jellz77
    Commented Apr 8 at 15:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .