Keyboard shortcuts for custom terminal commands in Ubuntu 17.10 (an example to suspend the system)
I recently got a new HP Laptop, and it does not have an inbuilt keyboard shortcut for
Suspend , and I couldn’t find it either in the Power-off option. I Googled a lot, and finally got the terminal command to Suspend the system.
In this article, we will be learning how to create a keyboard shortcut to
Suspend your PC or Laptop that uses Ubuntu 17.10.
Step 1: Create a shell script to
Suspend the system. I named the shell script file as
Step 2: Give executable permission for the created shell script in any directory, I created in my
chmod +x sleep.sh
Step 3: Open Ubuntu settings.
Step 4: Select
Devices and then
Step 5: Scroll down the window and click the
+ button, to create a custom shortcut. A pop window will appear, where you need to give a
Name for the shortcut, a command that will be executed when the shortcut is selected, and a button to set the shortcut. The command will be as follows:
gnome-terminal -e <path-to-the-executable-shell-script>
In my case the command was as follows:
gnome-terminal -e "/home/jeril/sleep.sh"
Step 6: Click the
Set Shortcut... button, and set your preferred shortcut. In my case it was
Alt + L. You can keep your preferred option (just press
Alt + L). Then a the popup windows will look like the following:
Step 7: Click
Add to create your shortcut. Now the
Keyboard settings will look like the following:
Now by pressing
Alt + L will put your system in
Hope it helps !!!