I often run my research experiments through my terminal. The command is a very long one, and often I find the need to change a parameter to the call. The problem is that the call line is long, and the parameter is for example in the middle of the line. To replace the parameter I must keep holding the left arrow/right arrow until I reach the point where the parameter is, then delete and rewrite the characters.
Is there a way to navigate the terminal command line using the mouse cursor position? Clicking in the middle of the line doesn't do anything, of course.
Example:
Suppose I have, in the terminal:
~> runThisProgram(a,b,c,d,……,v,w,x,y,z).
Now I want to run it but with X instead of the parameter c. I have to go to the end of that line, keep pressing the left arrow until I reach the c, and then delete and write X. (or, symmetrically, go to the beginning of the line, keep pressing the right arrow until I reach the c and then delete and write X). Is there a command to just point at the 'c' position using my cursor and go there?
Best Answer
You can move word at a time in shell: Alt+B moves cursor one word backward, Alt+F moves one word forward. Alt+D deletes word after cursor. More hotkey combinations for
bash
are explained in the manual.