Home » Internet » How to Quickly Create Keyboard Shortcuts in Ubuntu

How to Quickly Create Keyboard Shortcuts in Ubuntu

by Pratik

Keyboard shortcuts come really handy. You can set up to launch shell scripts, third-party apps or even particular webpages.  For instance, I have mapped Alt+Space to launch a shell script that stores my text snippets and I can quickly enter Postal Addresses, Credit Card number, etc. Moreover, Ubuntu lets you do all of these keyboard shortcuts mapping natively. Here’s a couple of ways to quickly create keyboard shortcuts in Ubuntu.

How to Quickly Create Keyboard Shortcuts in Ubuntu

1. Command Line

In case you are too accustomed to the command-line, there’s again two ways to do this – dconf and gsettings. If you already have dconf installed go ahead with it or else we’ll do it via gsettings. Foremost, we need to check whether the keyboard binding list is empty. In case it’s empty which usually it should be unless you have created shortcuts previously. Nonetheless, use the following command to check the keyboard shortcut list.

gsettings get org.gnome.settings-daemon.plugins.media-keys custom-keybindings

check-custom-key-bindings-list - custom keyboard shortcuts ubuntu

If you get a blank output like above, we need to first create a custom list. I am naming my list as “custom0”. You can have any name to it but just to keep it clean, we’ll go with “custom0”. Use the following command to do that.

gsettings set org.gnome.settings-daemon.plugins.media-keys custom-keybindings "['/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/']"

Once the command completes successfully, run the following command again to verify the custom key list creation. You should something similar to the following output.

gsettings get org.gnome.settings-daemon.plugins.media-keys custom-keybindings


Next, we have to add our key shortcuts to the “custom0” list we created just now. This requires a set of 3 commands which will first give our shortcut a name, file location, shortcut key accordingly. For instance, I want to map “Ctrl+Alt+Page_Down” to launch the Gedit editor. So, I simply found the location of the gedit application file using the “whereis” command. Below are the commands I used to do that.

gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/ name "'gedit_launch'"

gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/ binding "'<Alt><Ctrl>Page_Down'"

gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/ command "'/usr/bin/gedit'"


Once all the commands complete successfully, you should be able to launch the app on keypress. Moreover, you would also see an entry at the end under Keyboard.


In case you want to modify the shortcut, you can do it via the GUI.  Alternatively, if you run the same commands it would override the previous configurations.

2. GUI

You can also create the shortcut via the GUI and it’s more intuitive comparatively. To do that, head over to the settings menu and click on the Devices tab. Next, click on the Keyboard tab. Alternatively, you can also type “Keyboard” in the GNOME search bar.

keyboard-shortcuts-open-in-gnome-search - custom keyboard shortcuts ubuntu

On the Keyboard section, navigate to the bottom and click on the “+” button.


On the add shortcut pop-up, you have to enter the name, file location, and the keyboard shortcut. For instance, I want to map “Alt+Ctrl+Page_Down” to launch gedit application. So, I found out the file location of the gedit application file using the “whereis” command. Further, to add the keyboard shortcut, you just have to press on the “Set Shortcut…” button and it will record the keypress.

Post entering all the parameters, click on the Add button at the top-right corner.


Upon adding, you will be able to see your shortcut at the bottom of the page. If you can, you should be able to launch the app via the keyboard shortcut.


These keyboard shortcuts can also be used to launch shell scripts or app images. For more issues or queries, let me know in the comments below.

Also Read: Best Browsers For Ubuntu You Should Try in 2019

You may also like