Set the alias in linux-general Linux technology-Linux technology and application information. For details, refer to the following section. I recently learned about linux operations and found some methods to simplify the operations. For example, I can use some common commands as a brief alias.
Alias tomcat = "cd/usr/local/tomcat", but after exiting the system, these aliases become invalid. How to Write aliases to the configuration file:
First, find the user's folder to log on to. For example, when the ROOT user logs on to the/directory, go to the ROOT directory to edit the. bash_profile file.
For example, you can edit it like this (the alias lines are added). Of course, the system environment variables can also be written here.
#. Bash_profile
# Get the aliases and functions
If [-f ~ /. Bashrc]; then
.~ /. Bashrc
Fi
Alias tomcat = "cd/usr/local/tomcat"
Alias myip = "/sbin/ifconfig | grep-a 'inputadd' | sed-E'/127 \\. 0 \\. 0 \\. 1/d; s /. * inet addr :\\ ([0-9 \.] \\+ \\). */\ 1 /'"
# User specific environment and startup programs
PATH = $ PATH: $ HOME/bin
Export PATH
Unset USERNAME
Command that takes effect immediately after editing the. bash_profile File
Source. bash_profile
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service