Use the command unalias to remove aliases.
unalias aliasname
To remove the alias c which was created earlier.
unalias c
You also need to delete the alias from the ~/.bashrc file.
Make aliases permanent
As an example, the alias c typed in to the shell remains in effect only during the current login session. Once you log out or reboot, the alias c will be gone. To avoid this problem, add alias to your ~/.bashrc file
vi ~/.bashrc
The alias c for the current user can be made permanent by entering the following
alias c='clear'
Save and close the file. System-wide aliases (i.e. aliases for all users) can be put in the /etc/bashrc file. Please note that the alias command is built into a various shells including ksh, tcsh/csh, ash, bash and others.
Os specific aliases
Add code as follows in ~/.bashrc
Get os name via uname
_myos="$(uname)"
add alias as per os using $_myos
case $_myos in
Linux) alias foo='/path/to/linux/bin/foo';;
FreeBSD|OpenBSD) alias foo='/path/to/bsd/bin/foo' ;;
SunOS) alias foo='/path/to/sunos/bin/foo' ;;
*) ;;
esac
You can define a variety of aliases as follows to save time.
Control ls output
Colorize the output
alias ls='ls --color=auto'
Use a long listing format
alias ll='ls -la'
Show hidden files
alias l.='ls -d .* --color=auto'
Control cd command behavior
a quick way to get out of current directory
alias ..='cd ..'
alias .3='cd ../../../'
alias .4='cd ../../../../'
alias .5='cd ../../../../..'
Control grep command output
grep command is a command-line utility for searching plain-text files for lines matching a regular expression
Colorize the grep command output for ease of use (use for log files)
alias grep='grep --color=auto'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
Calculator with math support
alias bc='bc -l'
Generate sha1 digest
alias sha1='openssl sha1'
Create parent directories
Using mkdir
alias mkdir='mkdir -pv'
Improve aesthetics of the mount command
alias mount='mount |column -t'
Command short cuts to save time
short cuts
alias h='history'
alias j='jobs -l'
Create a new set of commands
alias path='echo -e ${PATH//:/\\n}'
alias now='date +"%T'
alias nowtime=now
alias nowdate='date +"%d-%m-%Y"'
Set vim as default
alias vi=vim
alias svi='sudo vi'
alias vis='vim "+set si"'
alias edit='vim'
Control output of ping
Stop after sending count ECHO_REQUEST packets
alias ping='ping -c 5'
Do not wait interval 1 second, go fast
alias fastping='ping -c 100 -s.2'
Show open ports
Use netstat command to list all TCP/UDP port on the server
alias ports='netstat -tulanp'
Control firewall (iptables) output
Netfilter is a host-based firewall for Linux operating systems. It is included as part of the Linux distribution and it is activated by default. This post list most common iptables solutions required by a new Linux user to secure his or her Linux operating system from intruders.
Update RHEL / CentOS / Fedora Linux
yum package management
alias update='sudo yum update'
alias updatey='sudo yum -y update'
Control web servers
pass via sudo so whoever is admin can reload it
alias nginxreload='sudo /usr/local/nginx/sbin/nginx -s reload'
alias nginxtest='sudo /usr/local/nginx/sbin/nginx -t'
alias lightyload='sudo /etc/init.d/lighttpd reload'
alias lightytest='sudo /usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf -t'
alias httpdreload='sudo /usr/sbin/apachectl -k graceful'
alias httpdtest='sudo /usr/sbin/apachectl -t && /usr/sbin/apachectl -t -D DUMP_VHOSTS'