How to Create Alias in Linux

The alias command can be used if you want to create a ‘shortcut’ to a shell command.

Syntax

# alias name='command'

Configuration

There are some frequently used commands, so in order to create the shortcuts we create the aliases for them in ~/.bashrc or /etc/bash.bashrc file.

# vi ~/.bashrc

alias search='grep'
alias v='vdir'
alias vdir='/bin/ls $LS_OPTIONS --format=long'
alias which='type -path'
alias wtf='watch -n 1 w -hs'
alias wth='ps -uxa | more'
alias cd..='cd ..'
alias cp='cp -i'
alias d='ls'
alias df='df -h -x supermount'
alias du='du -h'
alias egrep='egrep --color'
alias fgrep='fgrep --color'
alias grep='grep --color'
alias ls='ls -F --color=auto'
alias l='ls'
alias la='ls -a'
alias ll='ls -l'
alias lsd='ls -d */'
alias md='mkdir'
alias mv='mv -i'
alias p='cd -'
alias rd='rmdir'
alias rm='rm -i'

Save the file and enjoy shortcuts 🙂

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *