. Bash_profile and. bashrc

Source: Internet
Author: User
/Etc/profile sets the environment information for each user of the system. when the user logs on for the first time, the file is executed and starts from/etc/profile. the configuration file in the d directory collects shell settings. the variables set in the etc/profile can act on any user ~ The variables set in/. bashrc and so on can only inherit the variables in/etc/profile. /Etc/bashrc

/Etc/profile

Set environment information for each user in the system. when the user logs on for the first time, the file is executed and starts from/etc/profile. the configuration file in the d directory collects shell settings. the variables set in the etc/profile can act on any user ~ The variables set in/. bashrc and so on can only inherit the variables in/etc/profile.
/Etc/bashrc
Execute this file for every user running bash shell. When bash shell is opened, the file is read.
~ /. Bash_profile
You can use this file to enter the shell Information dedicated to your use. when you log on, this file is executed once. It sets some environment variables and executes the user's. bashrc file.
~ /. Bashrc
This file contains bash information dedicated to your bash shell. This file is read when you log on and each time you open a new shell.
~ /. Bash_logout
Execute this file every time you exit bash shell.
~ /. Bash_history
Record history input commands
The relevant files in my system are as follows, and the call relationship is also clear.
#/Etc/profile
# System wide environment and startup programs, for login setup
# Functions and aliases go in/etc/bashrc
Pathmunge (){
If! Echo $ PATH |/bin/egrep-q "(^ |:) $1 ($ |:)"; then
If ["$2" = "after"]; then
PATH = $ PATH: $1
Else
PATH = $1: $ PATH
Fi
Fi
}
# Ksh workaround
If [-z "$ EUID"-a-x/usr/bin/id]; then
EUID = 'id-U'
UID = 'id-ru'
Fi
# Path manipulation
If ["$ EUID" = "0"]; then
Pathmunge/sbin
Pathmunge/usr/sbin
Pathmunge/usr/local/sbin
Fi
# No core files by default
Ulimit-S-c 0>/dev/null 2> & 1
If [-x/usr/bin/id]; then
USER = "'id-un '"
LOGNAME = $ USER
MAIL = "/var/spool/mail/$ USER"
Fi
JAVA_HOME = '/usr/java/jdk1.6.0 _ 14'
HOSTNAME = '/bin/hostname'
History size = 1000
If [-z "$ INPUTRC"-! -F "$ HOME/. inputrc"]; then
INPUTRC =/etc/inputrc
Fi
Export path user JAVA_HOME LOGNAME MAIL HOSTNAME HISTSIZEINPUTRC
For I in/etc/profile. d/*. sh; do
If [-r "$ I"]; then
. $ I
Fi
Done
Unset I
Unset pathmunge
#. Bash_profile
# Get the aliases and functions
If [-f ~ /. Bashrc]; then
.~ /. Bashrc
Fi
# User specific environment and startup programs
JAVA_HOME =/usr/java/jdk1.6.0 _ 14
Export JAVA_HOME
PATH = $ PATH: $ HOME/bin
BASH_ENV = $ HOME/. bashrc
USERNAME = "root"
Export USERNAME BASH_ENV PATH
Export LC_ALL = zh_CN.gb2312
Export LANG = zh_CN.gb2312
Export LANGUAGE = zh_CN.2312
Unset USERNAME
Vi. bashrc
#. Bashrc
# User specific aliases and functions
Alias rm = 'rm-I'
Alias cp = 'CP-I'
Alias mv = 'MV-I'
# Source global definitions
If [-f/etc/bashrc]; then
./Etc/bashrc
Fi
#~ /. Bash_logout
Clear

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.