Zsh Shell: Custom alias that you may find useful


Zsh custom alias example
Zsh custom alias example

There are many commands that we use in Terminal often that may have many parameters (optional parameters) or are hard to remember and may take a while to type, alias command can help you to create shortcuts or name such commands with aliases that can help you speed up.

As Zsh is the default shell for macOS Big Sur (was made default since Catalina I suppose), I was trying to set my own aliases on my new MacBook, here is some examples of them that I have been using lately which you may find useful or get ideas from to create your own.

Note: If you are looking for how to set aliases follow this article:

  • desktop: Most often I save files on my desktop, so whatever directory I am and I want to go to desktop this alias takes me there,

    alias desktop='cd /Users/code2care/Desktop'
  • temp:In order to know the temperature of my place, I run a curl command that displays weather details.

    alias temp='curl wttr.in/chicago'
  • stop/start tomcat: Wherever I am, tying start my tomcat or stop my tomcat service. As a developer you might be using some other programming languages such as PHP, NodeJs and their application servers - you can make aliases for them as well.

    alias starttomcat='/Users/code2care/Desktop/starttomcat.sh'
  • stackoveflow: This one is my favourite, when I am stuck and need help, I type this alias command and Safari opens stackoveflow.com in a new tab.

    alias stackoverflow='open https://stackoveflow.com'
  • sublime: Opens Sublime Text Editor.

    alias sublime='open -a /Applications/Sublime\ Text.app;'


















Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap