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?

1 Answer 1


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

  • That's great. I like that, so I don't need to do anything fancy, just keep my aliases as is and expand them. Thanks.
    – YorSubs
    Nov 14, 2020 at 18:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.