Tips&Tricks

Bash aliases and startup commands

bash

Bash is not the only programming language, but the most important it’s a shell. So when you run a terminal, you get a bourne-again Shell. And you can configure this shell. For an instance, you can define functions, which you can use in other shell sessions.

Or you can define an alias for some command…

Aliases and other startup commands are stored in special files:

  • ~/.profile
  • ~/.bash_profile 
  • ~/.bashrc

And it’s extremely simple to add your alias there.

Note: Also you can use /etc/bash.bashrc for global definition (for all users).

For example:

echo "alias ll='ls -l'" >> /etc/bash.bashrc

– now you can use short to get a list of files!