Aliases in bash
How to set and unset an alias in bash
1. Listing aliases
To list the currently set aliases use the alias command. On Ubuntu this prints something similar to:
|
|
As we can see by default there are already some useful aliases set:
l- list [-Ccolumns, and-Fappend indicator (one of */=>@|) to entries]la- list [almost] allll- list long [-aall and-Fappend indicator]
2. Setting your own alias
As an example lets create an alias lh for the command ls -lh, that is the list command with the ‘long’ and ‘human-readable’ parameters. To do this run:
|
|
The alias will exist for the lifetime of the current terminal session.
3. Setting an alias permanently
To create a permanent alias modify your .bashrc file (located in your home directory) and append the command to set your custom alias.
4. Unset an alias
To unset an alias use the unalias command. To unset the alias we created in section 2 run:
|
|