m1gin 57

Using terminal in Linux for long commands and parameters sometimes became tiresome. Specially when we want to change some parameter in the middle of the commands. Instead of going backward and forward using keyboard, it would be nice if we just use the mouse pointer and click and edit the specific position.

And here is a tip we can use to edit the command in external editor. When I press Ctrl+X and then Ctrl+E in terminal (in my case: xfce4-terminal), current line will be opened in default editör. (in my case: nano).

I can edit the command in nano and save and exit. Then the edited command will be executed.

TIP: It is possible to enable mouse pointer in nano by Alt+M shortcut. Or for permanent solution, we can edit/create ~/.config/nano/nanorc file and add the following value in it:

set mouse

It is also possible to use another GUI text editör for editing the current commands and parameters by setting EDITOR variable:

export EDITOR=scite

After pressing Ctrl+X, Ctrl+E in terminal scite will be opened and I can edit the command easily. After I save and close scite the command will be executed.



There is a project called xterm_mouse on github which is allow to set position by clicking with mouse.


To see it in action:

  1. git clone --depth=1 https://github.com/tinmarino/mouse_xterm
  2. cd mouse_xterm
  3. source mouse.sh && mouse_track_start

If it gives some errors like:

"prompt_commandmouse_track_echo_enable: command not found"

Then edit mouse.sh and put the following line to the end of the file:


#linux #terminal #mouseposition #navigation #nanomousesupport #bashmousesupport #terminalmousesupport

Add to: