老男孩教育每日一题-第76天-说说/etc/profile /etc/bashrc .bashrc .bash_profile的区别

简介:

参考答案:

每个文件的含义

/etc/profile    主要用是系统的环境变量,同时我们也放些别名
/etc/bashrc    主要用来存放系统的别名和自己定义的函数(都可以放到 /etc/profile中)
.bashrc       是用户自己定义的别名
.bash_profile  是用户自己定义的环境变量

文件之间的联系:

测试方法在/etc/bashrc /etc/profile .bashrc .bash_profile 这四个文件的第一行和最后一行添加上标记

/etc/profile
/etc/profile
/root profile
/root bashrc
/etc/bashrc
/etc/bashrc
/root bashrc
/root profile

先读取/etc/profile文件,然后读取用户自己的.bash_profile然后读取.bashrc的内容最后读取/etc/bashrc这个文件。
这是这几个文件在用户登录的时候的运行的顺序。

网友答案:

北京-嘉嘉

etc下因该是全剧参数对所有用户生效,带点号的因该是当前用户生效。profile一般用于环境变量设置,bashrc一般用于别名设置

京-小刘

/etc/profile /etc/bashrc 为全局环境变量,到哪都可以用,这里只针对命令行,在一些软件中不行
/etc/profile 放置系统的变量   别名也可以放在这里
/etc/bashrc 放置别名
.bashrc .bash_profile 只针对当前登陆的用户生效

备注

今天是每日一题陪伴大家的第__76__天,期待你的进步。
对于题目和答案的任何疑问,请在博客评论区留言。
往期题目索引
http://lidao.blog.51cto.com/3388056/1914205

本文转自 李导 51CTO博客,原文链接:http://blog.51cto.com/lidao/1940708


相关文章
|
4月前
|
Linux Shell
百度搜索:蓝易云【Linux(centos7)缺失.bashrc文件登录出现bash-4.2解决教程。】
或者你可以注销并重新登录系统,也会加载新的 `.bashrc` 文件。现在,你应该能够成功解决 "bash-4.2" 错误并登录到 CentOS 7 系统中。
56 0
|
10月前
|
Unix Shell Linux
Linux中sh与bash的区别(详细介绍)
Linux中sh与bash的区别(详细介绍)
311 0
|
Shell 数据安全/隐私保护
profile,bashrc,.bash_profile,.bash_login,.profile,.bashrc,.bash_logout浅析 Part 2
profile,bashrc,.bash_profile,.bash_login,.profile,.bashrc,.bash_logout浅析 Part 2
53 0
|
Shell Linux Go
Linux profile1,bashrc,.bash_profile,.bash_login,.profile,.bashrc,.bash_logout浅析 Part1
Linux profile1,bashrc,.bash_profile,.bash_login,.profile,.bashrc,.bash_logout浅析 Part1
68 0
|
Shell
MAC修改.bashrc/.bash_profile无效,默认的用户配置文件是.zshrc,
MAC修改.bashrc/.bash_profile无效,默认的用户配置文件是.zshrc,
189 0
|
Shell
#!/bin/sh与#!/bin/bash有区别
#!/bin/sh与#!/bin/bash有区别
86 0
|
Shell
Bash shell中四种算术运算方式的区别与联系简介
在bash shell中,整数的运算也会偶尔遇到。为了彻底弄清其中的奥秘,我们通过实例验证的方式来探索一下常见的四种运算中的区别与联系。
1338 0
|
Shell Linux
Bash shell中bash、sh、source及“.”点的区别与联系
在众多Linux发行版中bash shell 可谓是随处可见。作为众多发行版的首选shell,对于bash shell的学习对我们来说,显得格外重要。
2239 0