Quick Answer: How to Create an Alias in Linux?

Quick Answer: How to Create an Alias in Linux?
Contents

How to define a Linux alias

  • Start with the alias command.
  • Then type the name of the alias you want to create.
  • Then an = sign, with no spaces on either side of the =
  • Then type the command (or commands) you want your alias to execute when it is run. This can be a simple command, or can be a powerful combination of commands.

How do I permanently create alias in Linux?

Luckily for us, this is simple to do in the bash-shell.

  1. Open your .bashrc. Your .bashrc file is located in your user directory.
  2. Go to the end of the file. In vim, you can accomplish this just by hitting “G” (please note that it is capital).
  3. Add the alias.
  4. Write and close the file.
  5. Install the .bashrc.

How do I create an alias in Unix?

To create an alias in bash that is set every time you start a shell:

  • Open your ~/.bash_profile file.
  • Add a line with the alias—for example, alias lf=’ls -F’
  • Save the file.
  • Quit the editor. The new alias will be set for the next shell you start.
  • Open a new Terminal window to check that the alias is set: alias.
David Miller
Author

David Miller

David Miller brings 15 years of experience in global economics, personal finance strategy, and market dynamics. He specializes in turning complex economic trends into actionable insights for everyday readers.