Custom keyboard shortcut to lauch a terminal and run a command in Unity

24,811

Solution 1

For Ubuntu 11.10 (Unity)

  1. Go to System Settings > Keyboard > Shortcuts > Custom Shortcuts.
  2. Add a new shortcut by pressing the + button.
  3. Choose a name for your shortcut, and in the 'Command' field, enter

    gnome-terminal -e "ping -c4 [your domain here]"
    
  4. Assign your shortcut key combination by selecting the shortcut and pressing the combination you desire (e.g. Ctrl+Alt+P).

Solution 2

For Lubuntu 20.04

  1. Go to Start button on taskbar > Preferences > LXQt settings > Shortcut Keys
  2. Press Add key to add new shortcut keys
  3. Click on Shortcut: and press your shortcut keys
  4. Write a description to the current shortcut keys
  5. Choose the type of running: Command or DBus message
  6. After implementing the running method press Ok
Share:
24,811

Related videos on Youtube

David Weinraub
Author by

David Weinraub

Updated on September 18, 2022

Comments

  • David Weinraub
    David Weinraub over 1 year

    I know this should be the simplest thing, but coming up empty. ;-(

    I would like to create a keyboard shortcut ctrl-alt-P that opens a terminal window and runs a ping command:

    ping -c 4 somefixeddomain.com

    [Useful for quickly checking whether my internet connection is actually working.]

    I have attempted to do this (in Unity, Ubuntu v11.10) using:

    Settings > Keyboard > Custom Shortcuts

    filling in all the obvious stuff, but no luck. All ideas welcome.

  • David Weinraub
    David Weinraub about 12 years
    gnome-terminal. Exactly what I needed. Thanks, mucho! ;-)
  • SimpleBinary
    SimpleBinary over 4 years
    It doesn't seem to work on 19.04, Disco Dingo. Is there any method for newer versions of Ubuntu?