> ## Content Index
> Fetch the complete content index at: https://itsfoss.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Improve Your Efficiency in Linux Terminal With Aliases
- URL: https://itsfoss.com/linux-alias/
- Published: 2024-04-02T10:38:29.000Z
- Updated: 2026-04-10T04:40:58.000Z
- Description: Unleash the super power of aliases in the terminal.
- Author: Sagar Sharma
- Tags: Terminal

You can make yourself more productive in the Linux terminal by creating aliases of the most frequently used command combinations.

For example, to update my Ubuntu system, instead of using:

```
sudo apt update && sudo apt upgrade -y
```

I just use `upd` and it works the same. How? Because I set an alias `upd` to the above update commands combination.

```
alias upd="sudo apt update && sudo apt upgrade -y"
```

Seems amazing, right? That's because it is. Let's discuss aliases in detail.

## What is the alias command in Linux?

The alias command allows you to create "custom commands" from existing Linux commands. It is primarily used for creating a short form of a long Linux command combination. So instead of typing `find / -type f -name *.txt`, you create an alias like `ftext` and just use this smaller 'command'.

This is particularly helpful when you have to regularly use some command combinations. Instead of manually typing them from memory and knowledge or copying it from your script collection, you can create an alias and quickly use them. 

## How to create an alias in Linux?

To create an alias for the currently logged-in session, you can use the alias command in the following manner:

```
alias short_name="your custom command here"
```

The quotes become mandatory if your command has more than one 'word'. I mean you can alias `gg=grep` but you cannot do `gg=grep --color=auto`. It has to be `gg='grep --color=auto`.

You can use either [single or double quotes](https://linuxhandbook.com/quotes-in-bash/?ref=itsfoss.com) depending on your need.

💡

There should not be any space around `=` while using the alias command.

I'll take a simple example here.

Let's say you are someone who uses `ls -la` frequently. In that case, you can create an alias for the ls command which will execute the ls -la when you only type `ls`.

Yes, you can replace an existing command with an alias of the same name.

```
alias ls="ls -la"
```

![create temporary alias for the ls command](https://itsfoss.com/content/images/2023/07/create-temporary-alias-for-the-ls-command.png)

As you can see when I executed `ls`, it automatically executed `ls -la`.

This is only temporary. If you log out of the terminal session, your alias will not work the next time.

### Remove the temporary alias

There is a dedicated command to remove the alias as well. It's called unalias, and it cannot be more obvious than this.

To remove a particular alias, give its name like this:

```
unalias alias_name
```

You can also remove all the aliases with:

```
unalias -a
```

Remember, all this will work with aliases set in the current session. If you make the alias permanent, the alias will be back again.

### Make alias permanent

If you want to create a permanent alias, then, you'd have to make changes in your `.bashrc` file.

So first, open the `.bashrc` file for editing:

```
nano ~/.bashrc
```

[Go to the end of the file in the nano](https://linuxhandbook.com/beginning-end-file-nano/?ref=itsfoss.com) text editor using `Alt + /` and add the lines as shown:

```
alias short_command='custom command here'
```

For example, here, I created an alias for `ls -lah` which will be executed when I use `ls`:

```
alias ls='ls -lah'
```

![create Permanent alias for the ls command in Linux](https://itsfoss.com/content/images/2023/07/create-Permanent-alias-for-the-ls-command-in-Linux.png)

Once done, [save changes and exit from the nano](https://linuxhandbook.com/nano-save-exit/?ref=itsfoss.com) text editor.

To take effect from the changes, source the file:

```
source ~/.bashrc
```

That's it!

💡

You can bypass an alias by preceding it with a `\`. For example, if you have aliased `ls` to `ls -lah`, you can type `\ls` to run just `ls` instead of `ls -lah`.

## How to list all the aliases?

To list existing alias, you can simply execute the following command:

```
alias
```

![list existing alias in Linux](https://itsfoss.com/content/images/2023/07/list-existing-alias-in-Linux.png)

As you can see, there's already one alias set for `--color=auto` which is the reason why the ls command uses different colors to indicate files, directories, and symlinks by default.

## Do you alias?

Trust me, aliases are super handy, specially if you have to work regularly in the terminal. I know a few sysadmins keep a long list of aliases that saves them the trouble of finding and typing complicated commands.

How about you? Do you use aliases on your Linux system? Which ones are you are proud of? Share them in the comments if they are not too sensitive?