We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Shell Aliases

A shell alias is a command shortcut. They're useful for shortening commands you run all the time.

Create an Alias

Maybe you always run ls with the same flags. You can make a shortcut for them:

alias ll="ls -la"

This creates a temporary alias for the current shell session. Until you close the shell, ll will run ls -la.

Running alias without any arguments lists all the active aliases in your current session.

Unalias

You can remove an alias with unalias:

unalias ll

That removes ll from the current session.

Persisting an Alias

If you want your alias to still work the next time you open your shell, you can add it to your shell configuration file.

Assignment

Add an alias to your config file.

  1. nano ~/.bashrc
    # or, if you're using zsh:
    nano ~/.zshrc
    
  2. alias reload='source ~/.bashrc'
    # or:
    alias reload='source ~/.zshrc'
    
  3. . ~/.bashrc
    # or:
    . ~/.zshrc
    
  4. alias
    

Paste the line that shows the reload alias and submit it.

You can remove reload from your config file after passing this lesson.