2

I want to add my own shortcuts to the terminal. So you know like Ctrl+Shift+C copies text, Ctrl+Shift+L clears the terminal.

I would like to be able to execute the command in the current terminal using shortcut. So for example, I press Ctrl+Shift+Q and ls -l executes, etc.

Is that possible?

  • 1
    your OS plz..... – PRATAP Mar 28 at 16:16
  • Sorry, thought that was implicit, it's Ubuntu 16.04. – zupazt3 Mar 28 at 16:25
1

as a workaround I could achieve this by the mix of

  1. Is it possible to achieve autocomplete to predifined text in gnome-terminal?
  2. Custom Keyboard Shortcut
  3. xdotool

enter image description here enter image description here enter image description here

1st image - created a alias for ls -l as ls in ~/.bashrc file.
2nd image - to type ls and a key press of Enter, used xdotool sleep 1 key l s Return as a command for custom keyboard shortcut.
3rd image - Result, when I press the shortcut key combo.

  • It's a bit of workaround, but I guess you cannot do any better, so thanks for the answer - it does what I needed. I've just changed xdotool sleep 1 key l s Return to xdotool sleep 0.2 key l s Return, so instead of 1 second it's 0.2 seconds - that way it works quickly. – zupazt3 Mar 29 at 9:58
  • yes it is (sleep value) always user prefered value and based on trails in some cases.. – PRATAP Mar 29 at 10:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.