4

How do you expand in place:

  • bash aliases
  • environment variables
  • history commands

to edit them and check they are correct?

For example, I have some aliases I use for flashing different devices and I just wanted to change the revision number to install, I don't really want to copy/paste from my .bashrc to do this.

1 Answer 1

5

bash offers the Ctrl+Alt+e shortcut (from the bash man page):

   shell-expand-line (M-C-e)
          Expand the line as the shell does. This performs alias and
          history expansion as well as all of the shell word expansions.

Examples:

  • ls Ctrl+Alt+e

    ls -aF --color
    
  • !268 Ctrl+Alt+e

    ps -aef
    
  • $PATH Ctrl+Alt+e

    /opt/vagrant/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
    

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .