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,
- How to connect AirPods to Mac
- Display Safari URL address link on hover
- Mac turn dark mode on or off using terminal command
- Docker Desktop needs privileged access macOS
- How to install Java on macOS [Big Sur]
- How to start/boot macOS in safe mode - Big Sur 11.0, Catalina 10.15, or Mojave 10.14
- Find Mac version using terminal command
- How to fix command not found brew (bash, zsh) on macOS Terminal
- How to change default macOS Terminal Window size
- How to make EditText text to uppercase or lowercase on macOS
- Disable Startup Sound on macOS
- How to switch from bash to zsh shell in macOS Terminal
- How to make macOS Terminal window Transparent (or Opaque)
- Remove Now Playing icon from macOS Big Sur Menu Bar
- Test internet speed using macOS Terminal command
- How to change macOS Safari default language
- Encode or Decode Base64 String using Mac Terminal Command
- Safari - Get HTTP Request Response Headers
- How to open terminal on Mac to run commands
- How to install homebrew (brew) on M1 Mac
- How to display directory tree in Mac Terminal
- How to Change Mouse Wheel Scroll Direction on Mac
- MacoOS - xyz is an app downloaded from the internet. Are you sure you want to open it? Alert
- The default interactive shell is now zsh. [macOS]
- Change Terminal Cursor Type in Mac (MacOS Shell)
More Posts:
- Country ISO Codes List - Java
- SQLite with Android Easy to Understand Tutorial that covers Select, Insert, Update and Delete - Android
- Amp Hello World Example - AMP
- Android : Exception raised during rendering: action_bar API 22 - Android
- 3 Python program to add two numbers - Python
- How to install powershell on macOS - Powershell
- Remove ActionBar from Activity that extends appcompat-v7 - Android
- The service instance - SharePoint