Question: Where Do You Put an Alias in Linux?

Question: Where Do You Put an Alias in Linux?
Contents

An alias is a (usually short) name that the shell translates into another (usually longer) name or command. Aliases allow you to define new commands by substituting a string for the first token of a simple command. They are typically placed in the ~/. bashrc (bash) or ~/.

Where is alias in Unix?

A new alias is defined by assigning a string with the command to a name. Alias are often set in the ~/. bashrc file.

How do I permanently store my alias?

Steps to create a permanent Bash alias:

  1. Edit ~/. bash_aliases or ~/. bashrc file using: vi ~/. bash_aliases.
  2. Append your bash alias.
  3. For example append: alias update=’sudo yum update’
  4. Save and close the file.
  5. Activate alias by typing: source ~/. bash_aliases.
Sarah Jenkins
Author

Sarah Jenkins

Sarah Jenkins is a veteran tech journalist with over 12 years of experience covering artificial intelligence, mobile innovations, and digital ethics. Her insights have appeared in leading technology publications worldwide.