1

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

pomsky
  • 70,557

1 Answers1

2

In bash, you can simply use aliases to achieve what you want. Just type the alias, then continue providing the arguments with tab completion.

If you need to effectively expand your alias before executing the command, then press the hotkey Ctrl+Alt+e. Thus, after you have typed the name of your abbreviation (= an alias), press that key combination to see the alias expanded.

See here on how to create a permanent alias.

vanadium
  • 97,564