I have started learning Ubuntu since 1 year..
During this 1 year period I typed a lot of these below texts in gnome-terminal
sudo -H nautilus /foo1/foo2/foo3/foo4/
sudo -H gedit /foo1/foo2/foo3/foo4/
what i am trying to ask is,
Is there a way I can configure like if I
type sn
and then press TAB, Autocompletion to sudo -H nautilus
type sg
TAB, Autocompletion to sudo -H gedit
I am Using Ubuntu 18.04 & 18.10 with gnome-terminal
Edit: I am not looking to type sn /foo1/foo2/foo3/foo4
or sg /foo1/foo2/foo3/foo4
.
looking for sn TAB or sn TAB TAB to see the text on terminal as sudo -H nautilus
1
to a completely different string of text, so I'm 90% sure this is not possible. What I'd suggest is creating a function or alias. Function and alias names don't allow for numeric names, so usesn
andsg
forsudo -H nautilus
andsudo -H gedit
instead. – Sergiy Kolodyazhnyy Mar 24 '19 at 09:33sn(){ sudo -H nautilus "$@" ; }
orfunction sn(){ sudo -H nautilus "$@" ;}
Of course the usage issn /path/to/directory
. Where to put those functions is explained in linked duplicate. I'll provide couple extra links in a minute – Sergiy Kolodyazhnyy Mar 24 '19 at 09:49xdotool
to basically erase what user typed into the terminal, and overwrite that with the desired command, but it's only going to be available in GUI, and not always in terminal. – Sergiy Kolodyazhnyy Mar 24 '19 at 10:14