Hotstrings on a bash console
I can do things like this to alias often used things alias iii='sudo yum install'
and that works fine, but it's nice to be able to expand a command on the command line as I use it. For sure I can type alias
to show all of the aliases, and I can even do command -V <command>
to expand aliases or functions, but it sometimes feels better to see the full layout of a command than aliases.
I think this is possible in bash, but I don't know how. With the above example, Could someone describe how to type i
, then i
, then i
, then space
, and for that to instantly delete the 3x i's to replace everything by sudo yum install
after which I can continue to type what I want?
in bash
it's Ctrl+Alt+E known as shell-expand-line (type bind -p |grep shell-expand-line
to see it bind to which keys); check it by
type your iii
alias created then press above keys combination short-cut.
Note that this shortcut expands almost everything, like variable expansion, command-substitution, process-substitution and others as well not only aliases, so be careful when using it