Alias entry in Linux is something where you assign a alias or supplementary name for a particular command. This can be done to save your time. You must be wondering how so let me explain my self with some examples below:
I have used these commands in RHEL and CentOS so I am not aware of the same in other distributions of Linux.
# netstat -ntlp
So every time in the above command I need to add the switch along with the command so to save my time I can make an alias entry where the next time if I want to use the same command with the same switches I will use some shortcut command.
# alias netstat=’netstat -ntlp’
So once I type this command and hit enter, next time I only need to type netstat and I would get the output for “netstat -ntlp“. It is not mandatory for you to use the same command name in the alias entry as it depends on the user. In the above case I could have given “deepak” as an alias entry for “netstat -ntlp” but it would be difficult to memorize the name for the command if there are multiple such entries.
alias cp=’cp -i’
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’
NOTE: The method which I explained you above will be session dependent so the next time you change your session or terminal again you will have to make an entry for alias. To get rid of this hectic situation you can make your alias entry in .bash_profile located inside root
Now run the bash file
# . .bash_profile
Now every time you login to your machine the mentioned alias entry will be updated and can be used.
# unalias “alias name”
# unalias netstat
But again this command will be session dependent until and unless you make changes in .bash_profile.
How to set environment (PATH) variable permanently in Linux
How to mount windows share on linux
Follow the below links for more tutorials:
Tutorial for Monitoring Tools SAR and KSAR with examples in Linux
How to configure Samba 4 Secondary Domain Controller
How to secure Apache web server in Linux using password (.htaccess)
How to register Red Hat Linux with RHN (Red Hat Network )
Red hat Enterprise Linux 5.5 Installation Guide (Screenshots)
15 tips to enhance security of your Linux machine
Why is Linux more secure than windows and any other OS
What is the difference between “su” and “su -” in Linux?
What is kernel-PAE in Linux?
What is swappiness and how do we change its value?
How to log iptables messages in different log file
What are the s and k scripts in the etc rcx.d directories
How to check all the currently running services in Linux
How to auto start service after reboot in Linux
What is virtual memory, paging and swap space?