Shell (Bash) Aliases Are Awesome

Linux shells allow you to create aliases for commands – a word you type to run another command or set of commands. You may have already encountered aliases, since most flavors come with a few variations of “ls” already created, so if you have ever typed “ll” and gotten the same output as “ls -alF”, it’s because you used an alias that ran “ls -alF”!

You can make any alias you want! Depending on which shell you use, you’ll be looking for different config files, but these mostly live in your home directory and look like “.bashrc”, “.zshrc”, “.cshrc”, or something similar (sometimes you may even find a file named .aliases or .bash_aliases which is imported into your .〇shrc file).

Find out what shell you are using and then look for the corresponding config file.

echo $0

In your shell’s config file, you can add aliases to catch typos so you don’t need to waste time retyping things.

alias sl="ls"
alias bim="vim"

You can add aliases to make hard-to-remember things much easier to remember.

alias jump="ssh wwwennndlllick@110.101.10.100"
alias prodjump="ssh wwwennnndlick@101.111.100.101"

You can add aliases to help facilitate navigation within your system.

alias intra="cd /home/vagrant/intra/src"
alias front="cd /home/vagrant/front/src"

After editing the shell’s config file, you will need to reload the shell. You can log out and log back in to accomplish this, open up a new instance, or run a command to reload/replace the shell.

exec $SHELL

With this knowledge, you can now save dozens of seconds per day!

One thought on “Shell (Bash) Aliases Are Awesome

Leave a Reply to eli Cancel reply

Your email address will not be published. Required fields are marked *