当前位置:网站首页>/etc/profile、/etc/bashrc、~/. Bashrc differences
/etc/profile、/etc/bashrc、~/. Bashrc differences
2022-06-26 15:23:00 【hurryddd】
1> etc The system management and configuration files are stored in the directory ( The system configuration )
etc/profile: profile Set system wide environment variables and startup sequence for all users , Read this file when the user logs in , This file is for each shell Are effective .
/etc/bashrc: For each run bash shell Of users executing this file , When bash shell When opened , The file is read . in other words , When the user shell Yes bash when , Run this file .
Summarized below :
/etc/profile The scope is greater than /etc/bashrc.
/etc/profile Load the configuration environment when all users log in ,/etc/bashrc All users are executing bash shell when , Load configuration environment .
2> ~/.bashrc( User configuration )
This file is stored exclusively for individuals bash shell Information about , When logging in and opening a new shell when , Execute this file , In this file, you can customize the user's exclusive personal information .
modify /etc The configuration file under the path will be applied to the whole system , It belongs to system level configuration , And modify the... Under the user directory .bashrc It's just limited to user applications , Belongs to user level settings . The two are different in the scope of application , If it needs to be modified , Modify the .bashrc, That is, there is no need to root jurisdiction , And it won't affect other users .
PATH environment variable
PATH Variables determine shell Which directories will you look for commands or programs . If the directory of the command to be executed is in $PATH in , You don't have to enter the full path of the command , Just type the command directly . Some third-party software doesn't put executable files in Linux In the standard catalog of . therefore , Add these nonstandard installation directories to $PATH It's a solution . Besides , You'll also see how to deal with general environment variables .
First , As a rule , All environment variable names are uppercase . because Linux Case sensitive , You should pay attention to this . Of course , You can define some variables yourself , Such as '$path'、'$pAtH', but shell Ignore these variables .
The second point is that variable names sometimes start with '$' start , But sometimes it's not . When you set a variable , Just use the name , And there's no need to add “$”, Such as
“PATH=/usr/bin:/usr/local/bin:/bin”
If you want to get the value of a variable , You have to put... Before the variable name '$':
“echo $PATH”
The currently set PATH Variable “/usr/bin:/usr/local/bin:/bin”
Otherwise , The variable name will be treated as plain text :
“echo PATH”
Show “PATH”
Handle $PATH The third thing to note about variables is : You can't just replace variables , Instead, add the new string to the original value . in the majority of cases , You can't use “PATH=/some /directory”, Because this will delete $PATH All the other directories in , So when you run the program on the terminal , We have to give the complete path . therefore , It can only be added :“PATH=$PATH:/some/directory”, If you want to add /usr/local/arm/3.4.1/bin Cross compile command , Then we can do “PATH=$PATH:/usr/local/arm/3.4.1/bin”
such ,PATH Set to the current value ( With $PATH To express )+ New catalog .
up to now , You only set up a new one for the current terminal $PATH Variable . If you open a new terminal , function echo $PATH , The old $PATH value , You can't see the new directory you just added . Because what you defined earlier is a local environment variable ( Current terminal only ).
To define a global variable , Make it effective in the terminal opened later , You need to output local variables (export), It can be used "export" command :
export PATH=$PATH:/some/directory
Now if you open a new terminal , Input echo $PATH , You can also see the new settings $PATH 了 . Please note that , command 'export' You can only change the variables in the current terminal and later running terminals . It has no effect on the running terminal .
To permanently add a directory to $PATH , As long as "export" Add the line of to .bashrc or /etc/bashrc In file .
Use command :
sudo gedit ~/.bashrc
边栏推荐
- Mongodb series window environment deployment configuration
- Pytorch深度学习代码技巧
- Pod of kubernetes
- Pod scheduling of kubernetes
- RestCloud ETL抽取動態庫錶數據實踐
- JS之事件
- Applicable and inapplicable scenarios of mongodb series
- 北京房山区专精特新小巨人企业认定条件,补贴50万
- R language uses ggplot2 to visualize the results of Poisson regression model and count results under different parameter combinations
- About selenium common. exceptions. Webdriverexception: message: an unknown server side error solution (resolved)
猜你喜欢

数据库-序列

【SNMP】snmp trap 介绍、安装、命令|Trap的发送与接收代码实现

Restcloud ETL extracting dynamic library table data

【ceph】CEPHFS 内部实现(一):概念篇--未消化

Smoothing data using convolution

【TcaplusDB知识库】TcaplusDB OMS业务人员权限介绍

Halcon C # sets the form font and adaptively displays pictures

Redis-集群

评价——TOPSIS

一篇博客彻底掌握:粒子滤波 particle filter (PF) 的理论及实践(matlab版)
随机推荐
[tcapulusdb knowledge base] tcapulusdb doc acceptance - create business introduction
MongoDB系列之适用场景和不适用场景
券商经理给的开户二维码安全吗?找谁可以开户啊?
【TcaplusDB知识库】TcaplusDB单据受理-建表审批介绍
RestCloud ETL抽取動態庫錶數據實踐
Pod scheduling of kubernetes
The tablestack function of the epidisplay package of R language makes a statistical summary table (descriptive statistics of groups, hypothesis test, etc.), does not set the by parameter to calculate
Unity C # e-learning (VIII) -- www
RestCloud ETL解决shell脚本参数化
【TcaplusDB知识库】TcaplusDB单据受理-创建游戏区介绍
1. accounting basis -- several major elements of accounting (general accounting theory, accounting subjects and accounts)
BLE抓包调试信息分析
R language uses ggplot2 to visualize the results of Poisson regression model and count results under different parameter combinations
[tcapulusdb knowledge base] tcapulusdb operation and maintenance doc introduction
Execution of commands in the cluster
TCP 复位攻击原理
The R language cartools package divides data, the scale function scales data, and the KNN function of the class package constructs a k-nearest neighbor classifier
【TcaplusDB知识库】TcaplusDB常规单据介绍
夏令营来啦!!!冲冲冲
How to load the contour CAD drawing of the engineering coordinate system obtained by the designer into the new earth