Command Line Alias

Posted in category Code Snippets on
256 Words ~2 Minute Reading Time • Subscribe to receive updates on Code Snippets
Eric David Smith
Software Engineer / Musician / Entrepreneur
Command Line Alias by Eric David Smith

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.

Aliases

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 is one that I use for managing several servers

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

Here is 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 permanently, I suggest you store them in your ~/.bash_profile or ~/.zshrc

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

alias

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

Supporting My Work

Please consider Buying Me A Coffee. I work hard to bring you my best content and any support would be greatly appreciated. Thank you for your support!

Contact


Eric David Smith
Software Engineer / Musician / Entrepreneur
Code Snippets

Related Blog Posts

👈 Scroll 👉

Blog Post Tags