Question: How to Make Alias in Linux?
Contents

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.

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.

What is an alias in Linux?

The alias Command. Its primary function is to read commands and then execute (i.e., run) them. The alias command is built into a number of shells including ash, bash (the default shell on most Linux systems), csh and ksh. It is one of several ways to customize the shell (another is setting environmental variables).

Chloe Bennett

Chloe Bennett

Culture, Media & Entertainment Columnist

Chloe Bennett explores the intersection of pop culture, streaming entertainment, digital trends, and contemporary lifestyle. Her weekly commentary reaches thousands of culture enthusiasts.

Share this article
Twitter Facebook Pinterest