Article Title: about how to set aliases in Linux. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
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 it. 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
In edit. Command that takes effect immediately after the bash_profile File
Source. bash_profile
202.118.251.231