Command Line Alias

/ Edit this post / code

If you're like me, then you run a hundred terminal commands each day and most of the time you have to pull up a saved note, google search, word doc, etc to recall what commands do what. To simplify things, I generally like to use aliases. Here's a basic example of how to use an alias:

alias name_of_command='command to be performed'

Here's one that I setup to open static files using Google Chrome

alias chrome='open -a "Google Chrome"'

Here's one that I use for managing several servers

alias name_of_server='ssh -v -l USERNAME IP ADDRESS'

Here's one that helps list directories in a two character command

alias la='ls -a'

This one is great for your fat fingers! You will be prompted to continue before deleting files. You are essentially in interactive mode with -i flag. (I personally do not use this one, but it could be a nice one for you)

alias rm='rm -i'

TIP: If you would like to store your aliases permenantly, I suggest you store them in your ~/.bash_profile

If you'd like to see your list of current aliases, simply run:


I hope you explore more aliases and I hope this helps you as much as it helps me.

Eric David Smith

Father / Software Engineer / Musician / Recording Engineer / Navy Veteran / Runner / Javascript / Crypto / Human ETH: 0xa9FFaD2A2cA147F784f4C82Ee6475afb6765A974

Read More