Alias comes very handy to create shortcuts for complex or large commands you use in Terminal, it can help you improve your productivity (and do not need to remember that complex command you always forget :D)

Creating alias on macOS
- Open Terminal (this article is based on Zsh shell as being default one for macOS as of 2021),
- Now type ~/ to go to your user directory
- Do a ls -a and check if you have the .zshrc file, if not we will create it,
- run command: nano ~/.zshrc
- Now add your alias in this file one per line, example:
- Now press Command + X to quite nano and click Y to save the file.
- To apply the changes type command: source ~/.zshrc
- Now try the command from any location in your terminal, they should work!
alias hello=ls
alias allfiles='ls -a ltrh'
✏️ Note that if there is a space in the the command, you should surround it with single quotes. There should be no space between the alias name and equals sign and its value.
⭐ Check out some examples aliases that you can create to improve your productivity!: Zsh Shell: Custom alias that you may find useful
More Posts related to MacOS,
- Opening mac Terminal
- How to change default macOS Terminal Window size
- How to clear Mac Terminal screen
- Find Hostname of Mac running on macOS Ventura 13
- Installing MongoDB on Linux/Unix/macOS/Ubuntu
- How to switch from bash to zsh shell in macOS Terminal
- Limit scrollback rows in macOS Terminal
- How to Set Background Wallpaper on macOS 13 Ventura
- This operation couldnt be completed. Unable to locate a Java Runtime. [macOS]
- Encode or Decode Base64 String using Mac Terminal Command
- List of All Apple Silicon ARM Based M1/M2 Mac [updated Oct 2022)
- How to remove Siri from Menu Bar [macOS Big Sur]
- Must Know Homebrew Commands for Mac/Linux Users
- Hide Keyboard Text Input Icon on macOS Ventura Menu Bar
- 13.0 MacOS Ventura release date
- How to change the default location of Mac Screenshot
- How to set Out Of Office (OOO) on Outlook for Mac
- 30+ Zoom video communications application shortcuts for macOS
- How to install wget on macOS
- Mac turn dark mode on or off using terminal command
- Create Symbolic Link using Terminal Command
- Mac - How to Install VirtualBox
- How to Enable or Disable Dark Mode on macOS Ventura 13
- How to install homebrew (brew) on M1 Mac
- How to uninstall Microsoft Outlook on Mac
More Posts:
- Struts 2 Hello World Example in Eclipse - Java
- Read JSON File in Python Program - Python
- Open Large File in Notepad++ (Fix: File is too big to be opened by Notepad++) - NotepadPlusPlus
- Install AWS CLI using Brew Command - AWS
- Know Bash shell version command - Bash
- Mac - Chrome Open a new window in Incognito mode - Chrome
- Perform an Empty Commit in Git without anything in Staging Area - Git
- List of Java Major Minor Version Numbers - Java