Categories
Tags
a Accessibility Advanced Algorithms Alias Bash bash Basics Beginners Best Practices Big O bun cat cd CLI Comments Container Elements Container Queries cp css CSS Data Structures deno Doctype Download Editors Error Examples Features figure File Watching Filesystem fish Fish Shell footer frontend Guide header Hello World History Homebrew HTML HTML5 humor img javascript JavaScript Learning less Links linux Linux ls macOS Media Queries meta Mobile-First mv Netcat Networking Node.js npm Package Manager picture pm2 Productivity programming Programming pwd Responsive Design Responsive Images rmdir Scalability section Semantic HTML shell Shell Shell Script Shells srcset State Management Structure Svelte Svelte Store SvelteKit svg Tables tail Text Formatting Tools touch Troubleshooting Tutorial Unix ux Vim web development Web Development web-development webdev
138 words
1 minutes
How to set an alias in a macOS or Linux shell
How to set an alias in a macOS or Linux shell
Aliases are shortcuts for commands that you frequently use. This guide explains how to set an alias in a macOS or Linux shell.
Setting an Alias
To set an alias, use the alias
command followed by the alias name and the command you want to alias.
alias alias_name='command'
For example, to create an alias for ls -la
, you can use:
alias ll='ls -la'
Making Aliases Permanent
To make aliases permanent, add them to your shell’s configuration file. For Bash, add the alias to ~/.bashrc
or ~/.bash_profile
. For Zsh, add the alias to ~/.zshrc
.
echo "alias ll='ls -la'" >> ~/.bashrc
source ~/.bashrc
Conclusion
Setting aliases can save you time and effort by creating shortcuts for frequently used commands. By adding aliases to your shell’s configuration file, you can make them permanent and available every time you open a terminal.
How to set an alias in a macOS or Linux shell
https://zxce3.net/posts/cli/how-to-set-an-alias-in-a-macos-or-linux-shell/