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,
- [macOS] How to search or view previous terminal command history
- [Eclipse] Locate Preferences in macOS
- macOS Big Sur compatible Macs List
- How to connect Airpods to Macbook Air or Pro?
- Display ls command file sizes in KB (kilobytes) MB (megabytes) or GB (gigabytes) [Linux/macOS]
- [macOS] Change homepage Macbook Safari Browser
- [Vi/Vim] How to move cursor to the start of a line
- bash: command not found error [macOS Terminal Linux, Unix or Windows]
- Set Python 3.8 as a default python version on macOS
- 30+ Zoom video communications application shortcuts for macOS
- say command macOS terminal examples
- Mac (macos) startup keyboard boot sequence combinations
- Cut, Copy and Paste keyboard commands on mac
More Posts:
- Notepad++ Convert text from lower to upper case - NotepadPlusPlus
- Difference between using Scanner Class and String args for user input in Java - Java
- How to Change Eclipse Default Web Browser - Eclipse
- Facebook : Warning: Request without access token missing application ID or client token - Facebook
- How to recover unsaved notepad file Windows 10 - NotepadPlusPlus
- This Toast was not created with Toast.makeText() : Android RuntimeException - Android
- Maven Unsupported major.minor version 51.0 - Java
- Toast not getting displayed Android App - Android
- How to reset eclipse layout - Android
- Upload docx file using PHP script - PHP
- Comprehensive 256 Ascii code table with Html Hex IBM Microsoft Key - Html
- reCAPTCHA Implementation Tutorial - CSS
- import servlet API to eclipse project (javax.servlet cannot be resolved error) - Java
- Android: Unknown error code during application install : - Android
- [Solved] SharePoint Search Internal server error exception - SharePoint