How to use the alias command in Linux
Created
The alias command lets you give your own name to a command or sequence of commands. You can then type your short name, and the shell will execute the command or sequence of commands for you.
List Currently Defined Aliases in Linux
List
alias
alias cp='cp -i' alias egrep='egrep --color=auto' alias fgrep='fgrep --color=auto' alias grep='grep --color=auto' alias l.='ls -d .* --color=auto' alias ll='ls -l --color=auto' alias ls='ls --color=auto' alias mv='mv -i' alias rm='rm -i' alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
Creating a Linux alias is very easy. You can either enter them at the command line as you're working, or more likely, you'll put them in one of your startup files, like your .bashrc file, so they will be available every time you log in.
l
alias l="ls -al"
l
Jul 1 13:28 .bash_history Dec 29 2013 .bash_logout
GIT
alias gpom="git push origin master"
alias gs="git status"
alias gb="git branch"
alias gco="git checkout"
To remove an alias added via the command line can be unaliased using unalias command.
unalias alias_name
unalias l
unalias -a [remove all alias]
-bash: l: command not found
The syntax for the alias command is as follows:
Usage:
alias [-p] [name[=value] ... ]
OPTIONS:
-pThis option prints all the defined aliases is resuable format.