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,
- Clear Screen shortcut macOS Terminal
- What is macOS Ventura?
- [fix] How to Show file extensions on all files on Mac
- How to Find Where Mac Terminal App is Located?
- AutoSave button not working on Office on Mac (Word, Excel or Powerpoint)
- macOS say command text to speech using various voices and languages
- How to change Ping TTL value on macOS
- Open .bash_profile File in TextEdit using Terminal
- How to know the Safari Version on Mac
- How to Copy full Absolute Path of a File on Mac
- 13.0 MacOS Ventura release date
- Enable spell check in Sublime Text (macOS)
- How to Display Analog Clock on Mac Menu Bar
- How to turn off Location Services macOS Ventura 13
- How to Open VS Code on Mac
- Add Bookmark macOS Safari
- How to Fix cd: too many arguments Error in Terminal: A Step-by-Step Guide
- How to install wget on macOS
- Select Line Number TextEdit on Mac
- Strikethrough Text in Excel for Mac
- How to Enable or Disable Dark Mode on macOS Ventura 13
- How to hide or display Wifi icon in macOS Bug Sur Menu Bar
- How to install Yarn on Mac (macOS)
- How to fix command not found brew (bash, zsh) on macOS Terminal
- How to Schedule Mails in macOS Ventura
More Posts:
- How to save IntelliJ IDE Console logs to external log file - Android-Studio
- [fix] psycopg2 Error: pg_config executable not found - Python
- Python f-strings Formatted String Literals Syntax and Examples - Python
- Android read text file from internal storage - Android
- How to upload file programmatically to SharePoint Document Library using Server Object Model C# .Net - SharePoint
- PowerShell Alias Type Commands List for Mac - MacOS
- Float built-in function in Python - Python
- [Fix] Spring Tool Suite STS Code Autocomplete not working with Eclipse - Eclipse