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)
- 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 show line numbers in Nano on Mac
- How to install Jupyter Notebook on macOS Sonoma
- How to Disable Remote Management using Mac Terminal
- Test internet speed using macOS Terminal command
- Docker Desktop needs privileged access macOS
- Google Search Hot Trends Screensaver for Mac OS X
- How to do calculations in Mac Terminal
- How to make TextEdit the default text Editor on Mac
- How to Show Full Website Address on Safari for Mac (Ventura/Sonoma)
- The Zsh Shell - Mac Tutorial
- Opening mac Terminal
- How to change the name of your Mac running on macOS Ventura 13
- How to find the Battery Cycle Count on macOS Ventura
- How to set an emoji as Zsh terminal prompt in macOS
- How to access Trash Folder using Mac Terminal Command
- macOS Ventura XCode Command Line Tools Installation
- Hide Bluetooth icon on Mac Menu Bar macOS Ventura 13
- How to run .sh file in Mac Terminal
- Terminal Command to get the list of available shells in macOS
- How to see Storage Information on macOS Ventura
- How to Go To /usr/local/bin on Mac Terminal?
- How to do screen recording on Mac
- How to Find File and Directory Size in Mac Terminal
- Open .bash_profile File in TextEdit using Terminal
- Remove Now Playing icon from macOS Big Sur Menu Bar
More Posts:
- Command to know the installed Debian version? - Linux
- Make Android View Scrollable both Horizontally and Vertically - Android
- How to Know Version of Windows Terminal - Windows
- Installing vue.js in Laravel 8 - PHP
- Python: Determine Variable Type Example - Python
- How to format or prettify XML in Notepad++ - NotepadPlusPlus
- How to Subscribe to Google Nest Aware on iPhone - Google
- Get count of SharePoint List or Document Library Items using PowerShell - SharePoint