Keyboard shortcut to insert text in terminal?

Questions about applications and software
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
Gaia

Keyboard shortcut to insert text in terminal?

Post by Gaia »

Hi,

I'm used to using a Mac and in the Terminal there you can set specific keybindings. For example, I can set Shift + F6 to send a string of text to terminal that I use most often. Is there a way to do that with the Linux Mint terminal? I use guake as well, though I couldn't see any options. Idealy I would like to be able to send a string to terminal via keyboard shortcuts.

Thanks!
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
vercan

Re: Keyboard shortcut to insert text in terminal?

Post by vercan »

You can copy and paste text to and from the terminal, simply use the shortcuts: Ctrl+Shift+C for Copy and: Ctrl+Shift+V for Paste. All applications recognize Ctrl+C for Copy and Ctrl+V for Paste, but the terminal needs the Shift key also.
Gaia

Re: Keyboard shortcut to insert text in terminal?

Post by Gaia »

Thanks, though I mean without needing copy/paste :) I want to define a set of text to a keybinding and be able to insert that text into terminal at any time without having to use the clipboard. It's possible in Mac OSX, but can't seem to find such an option in linux.
vercan

Re: Keyboard shortcut to insert text in terminal?

Post by vercan »

Oh, I see. If the text you need to send is a linux command, then you could use an alias, like this:

Code: Select all

alias dir="ls -la"
and then, anytime I need to run the: ls -la command, I simply type dir. But if you need to send text that will be part of a more complex command, then the alias won't work for you.

If this is a solution for you, then you would add all your aliases commands to your ~/.bashrc file.
Gaia

Re: Keyboard shortcut to insert text in terminal?

Post by Gaia »

vercan wrote:Oh, I see. If the text you need to send is a linux command, then you could use an alias, like this:

Code: Select all

alias dir="ls -la"
and then, anytime I need to run the: ls -la command, I simply type dir. But if you need to send text that will be part of a more complex command, then the alias won't work for you.

If this is a solution for you, then you would add all your aliases commands to your ~/.bashrc file.
Aliases won't work as it's not always local. I'll need to be able to send the text to various ssh sessions, so won't have access to that specific alias unless I configure it on each server I access. I'd need a way to be able to send the text from a local shortcut to any terminal window, no matter the location. Mac OSX does it so there must be a way :?
Locked

Return to “Software & Applications”