Re: [PLUG] Terminal shortcuts

2018-06-20 Thread Paul Heinlein

On Wed, 20 Jun 2018, John Jason Jordan wrote:


On Wed, 20 Jun 2018 05:52:06 -0700 (PDT)
Rich Shepard  dijo:


On Tue, 19 Jun 2018, wes wrote:


Alias! Alias is prezackly what I was looking for!

I knew there had to be a way!


alias is good for string:string conversions, and probably just what 
you want. If there ever comes a point where you want to have options 
that get interpolated into the output string, then a function may be 
the ticket.


I have a handful of machines in my home domain; I ssh into all of them 
fairly regularly. I'm not a fan of using short hostnames for ssh 
logins, so I have this habit of only using fully qualified domain 
names. Of course, all that typing is a nuisance. So I conconcted a 
simple function:


  mli ()
  {
ssh $1.madboa.com
  }

So

  mli clayton

becomes

  ssh clayton.madboa.com

This works even better with bash's complete utility:

  complete -W 'arrowhead clayton omega silver tunnel' mli

Which allows me to tab-complete hostnames from the shell prompt when 
using the mli function.


A couple years ago, I posted to my web site a more complex example 
that allows optional positional parameters:


  https://www.madboa.com/blog/2015/09/28/ipmicli-function/

--
Paul Heinlein
heinl...@madboa.com
45°38' N, 122°6' W___
PLUG mailing list
PLUG@pdxlinux.org
http://lists.pdxlinux.org/mailman/listinfo/plug


Re: [PLUG] Terminal shortcuts

2018-06-20 Thread Rich Shepard

On Wed, 20 Jun 2018, John Jason Jordan wrote:


Alias! Alias is prezackly what I was looking for!


  Alas! Alas! Where's my missing alias?

  Glad you found alternative solutions, John.

Rich
___
PLUG mailing list
PLUG@pdxlinux.org
http://lists.pdxlinux.org/mailman/listinfo/plug


Re: [PLUG] Terminal shortcuts

2018-06-20 Thread John Jason Jordan
On Wed, 20 Jun 2018 05:52:06 -0700 (PDT)
Rich Shepard  dijo:

>On Tue, 19 Jun 2018, wes wrote:

Alias! Alias is prezackly what I was looking for!

I knew there had to be a way!

Thanks to all for the replies!
___
PLUG mailing list
PLUG@pdxlinux.org
http://lists.pdxlinux.org/mailman/listinfo/plug


Re: [PLUG] Terminal shortcuts

2018-06-20 Thread Rich Shepard

On Tue, 19 Jun 2018, wes wrote:


Since the utility you're calling is mkvmerge, I might be tempted to create
an alias called "mm". That doesn't do anything on my system, but you might
want to check yours first to make sure it's not taken. Such an alias would
look like so:

alias mm='mkvmerge -i'

Thereafter, you can simply type mm , and you're off to the
races. Bash automagically passes along any arguments you supply to an alias.


  +1 for aliasing frequently used commands. I have several aliases in
~/.bashrc:

alias ls='ls --color=tty -F'
alias rm='rm -i'
alias ll='ls -la'

I've used them so long they're automatic.

Rich
___
PLUG mailing list
PLUG@pdxlinux.org
http://lists.pdxlinux.org/mailman/listinfo/plug


Re: [PLUG] Terminal shortcuts

2018-06-20 Thread Rich Shepard

On Tue, 19 Jun 2018, Galen Seitz wrote:


Up arrow or Ctrl-r to get the desired command. Ctrl-e to place the cursor
at the end of the command (if it's not already there), ctrl-w to erase the
last argument (the old filename). Then type your new argument (the new
filename), using the tab character for filename completion.


  This works for urxvt, too, with a minor difference. In urxvt the up arror,
or C-r to search for the last command, positions the cursor at the end of
the command line.

  A short bash script to repeat the command for all movie names will save
time if the moves are repeated with a different batch of file names.

Rich
___
PLUG mailing list
PLUG@pdxlinux.org
http://lists.pdxlinux.org/mailman/listinfo/plug


Re: [PLUG] Terminal shortcuts

2018-06-19 Thread Larry Brigman
On Tue, Jun 19, 2018 at 10:47 PM wes  wrote:

> >
> >
> > OK, this is Linux, where someone a long time ago decided to name a root
> > folder /usr to save typing just one tiny letter. I mean, seriously.
> > There has to be a way to save constantly re-typing at the command line.
> > Any suggestions?
> >
>
> I have so many command aliases, that I've moved them out of my .bashrc into
> their own .shell_aliases file. You'll want to find a handy combination of
> letters which don't already belong to a command, and create one to suit
> your purposes. There are many ways to do this, each having their own pros
> and cons. I'll discuss one way; I'm sure others will chime in with various
> other solutions and tell me what's missing from mine.
>
> Since the utility you're calling is mkvmerge, I might be tempted to create
> an alias called "mm". That doesn't do anything on my system, but you might
> want to check yours first to make sure it's not taken. Such an alias would
> look like so:
>
> alias mm='mkvmerge -i'
>
> Thereafter, you can simply type mm , and you're off to the
> races. Bash automagically passes along any arguments you supply to an
> alias.
>
> You can place this in your .bashrc file if you want it to be available upon
> each future login.
>
> And bash (or zsh) autocomplete will try to autocomplete using esc-esc and
that applies to aliases too.
___
PLUG mailing list
PLUG@pdxlinux.org
http://lists.pdxlinux.org/mailman/listinfo/plug


Re: [PLUG] Terminal shortcuts

2018-06-19 Thread wes
>
>
> OK, this is Linux, where someone a long time ago decided to name a root
> folder /usr to save typing just one tiny letter. I mean, seriously.
> There has to be a way to save constantly re-typing at the command line.
> Any suggestions?
>

I have so many command aliases, that I've moved them out of my .bashrc into
their own .shell_aliases file. You'll want to find a handy combination of
letters which don't already belong to a command, and create one to suit
your purposes. There are many ways to do this, each having their own pros
and cons. I'll discuss one way; I'm sure others will chime in with various
other solutions and tell me what's missing from mine.

Since the utility you're calling is mkvmerge, I might be tempted to create
an alias called "mm". That doesn't do anything on my system, but you might
want to check yours first to make sure it's not taken. Such an alias would
look like so:

alias mm='mkvmerge -i'

Thereafter, you can simply type mm , and you're off to the
races. Bash automagically passes along any arguments you supply to an alias.

You can place this in your .bashrc file if you want it to be available upon
each future login.

-wes
___
PLUG mailing list
PLUG@pdxlinux.org
http://lists.pdxlinux.org/mailman/listinfo/plug


Re: [PLUG] Terminal shortcuts

2018-06-19 Thread Galen Seitz

On 06/19/2018 10:09 PM, John Jason Jordan wrote:

I prefer Gnome terminal because it is more visually configurable than
others that I have tried.

Often I need to repeat a command with a different object, so the up
arrow doesn't save typing. For example:

mkvmerge -i  (and repeat with a different movie)

It annoys me that I keep having to re-type 'mkvmerge -i' over and over
again. I could copy it to the clipboard and paste it in, except that I
use the clipboard to get , which overwrites the clipboard.
And besides, 'mkvmerge -i' is only one of several such commands that I
have to keep re-typing.

What would be really cool would be an 'auto-text' feature as in a word
processor, where you can create a series of letters (any length) and
assign it a short sequence of letters that you can type to invoke the
entire series of letters.

Web searching found me Ctrl-r, but if I type mkv- it pops up the entire
preceding command, including .

OK, this is Linux, where someone a long time ago decided to name a root
folder /usr to save typing just one tiny letter. I mean, seriously.
There has to be a way to save constantly re-typing at the command line.
Any suggestions?


Up arrow or Ctrl-r to get the desired command.  Ctrl-e to place the 
cursor at the end of the command (if it's not already there), ctrl-w to 
erase the last argument (the old filename).  Then type your new argument 
(the new filename), using the tab character for filename completion.


There's other fancy editing that can be done.  This is just the first 
one that comes to mind.  Note that this assumes you haven't changed the 
default editing characters.  For instance, ctrl-e is Emacs go to end of 
line.  There is at least one other alternative mappings based on vi.



galen
--
Galen Seitz
gal...@seitzassoc.com
___
PLUG mailing list
PLUG@pdxlinux.org
http://lists.pdxlinux.org/mailman/listinfo/plug


Re: [PLUG] Terminal shortcuts

2018-06-19 Thread Tomas Kuchta
I would check for alias

Man alias or bash is your friend.
That allows you to assign shortcuts to a command and save typing.

Another alternative, more flexible, would be to create wrapper scrtipt or
function for your long commands.

-T

On Tue, Jun 19, 2018, 10:37 PM Russell Senior 
wrote:

> You can cut/paste with ctrl-shift-c/ctrl-shift-v in gnome terminal, afaik.
> What don't you like about up-arrow?  That you have to backspace over
> things?  There's probably a delete-word binding, Ctrl-W.  So, maybe Ctrl-P
> Ctrl-W?
>
> On Tue, Jun 19, 2018 at 10:09 PM, John Jason Jordan 
> wrote:
>
> > I prefer Gnome terminal because it is more visually configurable than
> > others that I have tried.
> >
> > Often I need to repeat a command with a different object, so the up
> > arrow doesn't save typing. For example:
> >
> > mkvmerge -i  (and repeat with a different movie)
> >
> > It annoys me that I keep having to re-type 'mkvmerge -i' over and over
> > again. I could copy it to the clipboard and paste it in, except that I
> > use the clipboard to get , which overwrites the clipboard.
> > And besides, 'mkvmerge -i' is only one of several such commands that I
> > have to keep re-typing.
> >
> > What would be really cool would be an 'auto-text' feature as in a word
> > processor, where you can create a series of letters (any length) and
> > assign it a short sequence of letters that you can type to invoke the
> > entire series of letters.
> >
> > Web searching found me Ctrl-r, but if I type mkv- it pops up the entire
> > preceding command, including .
> >
> > OK, this is Linux, where someone a long time ago decided to name a root
> > folder /usr to save typing just one tiny letter. I mean, seriously.
> > There has to be a way to save constantly re-typing at the command line.
> > Any suggestions?
> > ___
> > PLUG mailing list
> > PLUG@pdxlinux.org
> > http://lists.pdxlinux.org/mailman/listinfo/plug
> >
> ___
> PLUG mailing list
> PLUG@pdxlinux.org
> http://lists.pdxlinux.org/mailman/listinfo/plug
>
___
PLUG mailing list
PLUG@pdxlinux.org
http://lists.pdxlinux.org/mailman/listinfo/plug


Re: [PLUG] Terminal shortcuts

2018-06-19 Thread Russell Senior
F1 in the terminal will bring up the terminal help page, there is a
keyboard shortcuts link that lists them.

On Tue, Jun 19, 2018 at 10:37 PM, Russell Senior 
wrote:

> You can cut/paste with ctrl-shift-c/ctrl-shift-v in gnome terminal,
> afaik.  What don't you like about up-arrow?  That you have to backspace
> over things?  There's probably a delete-word binding, Ctrl-W.  So, maybe
> Ctrl-P Ctrl-W?
>
> On Tue, Jun 19, 2018 at 10:09 PM, John Jason Jordan 
> wrote:
>
>> I prefer Gnome terminal because it is more visually configurable than
>> others that I have tried.
>>
>> Often I need to repeat a command with a different object, so the up
>> arrow doesn't save typing. For example:
>>
>> mkvmerge -i  (and repeat with a different movie)
>>
>> It annoys me that I keep having to re-type 'mkvmerge -i' over and over
>> again. I could copy it to the clipboard and paste it in, except that I
>> use the clipboard to get , which overwrites the clipboard.
>> And besides, 'mkvmerge -i' is only one of several such commands that I
>> have to keep re-typing.
>>
>> What would be really cool would be an 'auto-text' feature as in a word
>> processor, where you can create a series of letters (any length) and
>> assign it a short sequence of letters that you can type to invoke the
>> entire series of letters.
>>
>> Web searching found me Ctrl-r, but if I type mkv- it pops up the entire
>> preceding command, including .
>>
>> OK, this is Linux, where someone a long time ago decided to name a root
>> folder /usr to save typing just one tiny letter. I mean, seriously.
>> There has to be a way to save constantly re-typing at the command line.
>> Any suggestions?
>> ___
>> PLUG mailing list
>> PLUG@pdxlinux.org
>> http://lists.pdxlinux.org/mailman/listinfo/plug
>>
>
>
___
PLUG mailing list
PLUG@pdxlinux.org
http://lists.pdxlinux.org/mailman/listinfo/plug


Re: [PLUG] Terminal shortcuts

2018-06-19 Thread Russell Senior
You can cut/paste with ctrl-shift-c/ctrl-shift-v in gnome terminal, afaik.
What don't you like about up-arrow?  That you have to backspace over
things?  There's probably a delete-word binding, Ctrl-W.  So, maybe Ctrl-P
Ctrl-W?

On Tue, Jun 19, 2018 at 10:09 PM, John Jason Jordan  wrote:

> I prefer Gnome terminal because it is more visually configurable than
> others that I have tried.
>
> Often I need to repeat a command with a different object, so the up
> arrow doesn't save typing. For example:
>
> mkvmerge -i  (and repeat with a different movie)
>
> It annoys me that I keep having to re-type 'mkvmerge -i' over and over
> again. I could copy it to the clipboard and paste it in, except that I
> use the clipboard to get , which overwrites the clipboard.
> And besides, 'mkvmerge -i' is only one of several such commands that I
> have to keep re-typing.
>
> What would be really cool would be an 'auto-text' feature as in a word
> processor, where you can create a series of letters (any length) and
> assign it a short sequence of letters that you can type to invoke the
> entire series of letters.
>
> Web searching found me Ctrl-r, but if I type mkv- it pops up the entire
> preceding command, including .
>
> OK, this is Linux, where someone a long time ago decided to name a root
> folder /usr to save typing just one tiny letter. I mean, seriously.
> There has to be a way to save constantly re-typing at the command line.
> Any suggestions?
> ___
> PLUG mailing list
> PLUG@pdxlinux.org
> http://lists.pdxlinux.org/mailman/listinfo/plug
>
___
PLUG mailing list
PLUG@pdxlinux.org
http://lists.pdxlinux.org/mailman/listinfo/plug


[PLUG] Terminal shortcuts

2018-06-19 Thread John Jason Jordan
I prefer Gnome terminal because it is more visually configurable than
others that I have tried.

Often I need to repeat a command with a different object, so the up
arrow doesn't save typing. For example:

mkvmerge -i  (and repeat with a different movie)

It annoys me that I keep having to re-type 'mkvmerge -i' over and over
again. I could copy it to the clipboard and paste it in, except that I
use the clipboard to get , which overwrites the clipboard.
And besides, 'mkvmerge -i' is only one of several such commands that I
have to keep re-typing.

What would be really cool would be an 'auto-text' feature as in a word
processor, where you can create a series of letters (any length) and
assign it a short sequence of letters that you can type to invoke the
entire series of letters.

Web searching found me Ctrl-r, but if I type mkv- it pops up the entire
preceding command, including .

OK, this is Linux, where someone a long time ago decided to name a root
folder /usr to save typing just one tiny letter. I mean, seriously.
There has to be a way to save constantly re-typing at the command line.
Any suggestions?
___
PLUG mailing list
PLUG@pdxlinux.org
http://lists.pdxlinux.org/mailman/listinfo/plug