Is there a way speed up Linux CLI navigation when I must enter long commands? I simply use arrows right now, and - if I have a long command it takes some time to get from start of the command to the middle of it.
Is there a way to for example jump to the middle of the command without using arrows?
Some useful line editing key bindings provided by the Readline library:
Some more shortcuts from here
If you're a vi[m] and bash user, you may find it useful to make readline (used by bash) use vi-style editing by adding
set editing-mode vi
to your~/.inputrc
or/etc/inputrc
files. Or, you could just make bash use vi-style editing by running the bash commandset -o vi
. Add the command to your~/.bashrc
file to make the behavior persistent.If you're a zsh user, add
bindkey -v
to your.zshrc
file for vi-style editting.I do not know of a way to specifically jump to the middle without using the cursor keys. However, I can recommend using Ctrl + cursor key to move from blank to blank (i.e., jump from one word to another).
Source the code-snippet below in your .bashrc. Ctrl-a jumps to the start and pressing Ctrl-a again jumps to the middle.
Or if you want to use Ctrl-Something to directly jump to the middle, change the code to:
And bind it to something different than Ctrl-a.