Alias ​​literally means nickname or alias. Its meaning is no different in the terminal world…

Alias ​​in Terminal command, allows you to assign a sort of shortcut to a command or a series of commands by naming them. 

So, why should we use the alias command? 

  • With the alias command, we can assign shortcuts that will make our life easier. 
  • We have the opportunity to do more with less effort.
  • We can correct the commands that we often type incorrectly, and get rid of the constant errors.
  • We can fit long operations that we perform with more than one command into a single command.
  • We can save our time and energy.
  • If we have migrated from another platform, we can "move" the commands there to our system.

The benefits of Alias ​​are not limited to what I mentioned above. In order not to prolong the subject further, I prefer to continue the article.

Using the alias command

to the terminal alias When you enter the command, you can see the previously defined alias. If you want to define a new alias, the usage of the command is as follows.

alias =” ”

Let's understand the usage better with a real example;

alias ls = 'ls --color = auto'

This alias ls It is used to color the output of the command. It is an alias that is active by default in your Pardus.

You can also use the alias command for tasks such as opening a file in a specific location or running a script.

alias fileyiac=”/file/path/file.extent” alias scriptcalistir=”/file/path/script”

Temporarily disable defined alias

If you want to temporarily disable the alias you have defined, there are various methods for this.


Backslash at the beginning of alias (\by adding the ) sign,


By typing the command you want to run raw as above,


You can run the command by entering the full file path and temporarily disable the alias you have defined.

Removing defined alias


You can completely remove the alias you have defined by using the unalias command in the terminal.

Making the defined alias permanent

As long as the created aliases are not removed, they are normally limited to the terminal session. When the session ends, the default values ​​are restored. If you have an alias that you use all the time, there is a way to make it permanent.

You use of the shell (shell) settings file (for example Bash shell) .bashrc, for Zsh Shell .zshrc file) by typing the alias you want to use permanently, you can have it defined automatically at every boot.

For this, you must first open the configuration file of the shell you are using in a text editor. 

For #bash shell: nano ~/.bashrc For #zsh shell: nano ~/.zshrc

Then scroll down to the bottom of the file and add your alias. After you finish your work CTRL + X You can save and exit the file using the shortcut. 

Examples of aliases

ls command shortcuts

# Color command output # alias ls='ls --color=auto' # More detailed and more readable ls output # alias ll='ls -lah'

cd command shortcuts

# Get rid of misspelling # alias cd..='cd ..' # Make it easier to navigate between directories # alias ..='cd ..' alias ...='cd ../../../' alias .. ..='cd ../../../../' alias .....='cd ../../../../' alias .4='cd ../. ./../../' alias .5='cd ../../../../..'

grep command shortcuts

# Color command output # alias grep='grep --color=auto' alias egrep='egrep --color=auto' alias fgrep='fgrep --color=auto'

Creating new commands

alias path='echo -e ${PATH//:/\\n}' alias now='date +"%T"' alias nowtime=now alias nowdate='date +"%d-%m-%Y" '

For vimists

alias vi=vim alias svi='sudo vi' alias vis='vim "+set si"' alias edit='vim'

Showing open TCP/UDP ports

alias ports='netstat -tulanp'

A little bit of security (for ourselves)

# Warn or delete if more than 3 files are being deleted at once # alias rm='rm -I --preserve-root' # Get confirmation # alias mv='mv -i' alias cp='cp -i' alias ln='ln - I'

Making system update easier 

# Update system with one command # alias update='sudo apt-get update && sudo apt-get upgrade -y' # Upgrade system # alias upgrade='sudo apt-get update && sudo apt-get full-upgrade -y'

Shutdown/suspend/restart system easily

alias reboot='sudo /sbin/reboot' alias fisicek='sudo /sbin/poweroff' alias hold='sudo /sbin/halt' alias shutdown='sudo /sbin/shutdown'

Resume downloads by default with wget

alias wget='wget -c'

Repeat the last command "politely" with sudo

alias please='sudo $(fc -ln -1)'

Note: We do not recommend using the alias command for SSH connections. Instead of ~/.ssh/config The OpenSSH settings file located at the location is much more functional. You can find an example SSH setting below.

Host myServer Hostname IdentityFile ~/.ssh/id_rsa user pardus

After saving this setting, you can easily make an SSH connection by entering the following command.

ssh myServer

In this article, you have seen how useful the alias command can actually be, sometimes even a life saver. You can correct frequently mistyped commands, create your own shortcut commands, do more work with less effort, and use your time and energy more efficiently.