zoukankan      html  css  js  c++  java
  • shell入门-系统和用户的配置文件

    变量分为系统变量和用户自定义变量,他们的配置文件当然分为系统环境变量配置文件和用户环境变量控制文件

    1.规定环境变量的配置文件

    [root@wangshaojun 111]# vim /etc/profile  

    建议我们在/etc/profile.d下创建*.sh文件来修改

    2.修改全局参数的配置文件里的变量

    [root@wangshaojun 111]# vim /etc/profile.d/path.sh

        #!/bin/bash

       export PATH=$PATH:/tmp/:/date/bin/
       ~
       ~ 

       :wq

    [root@wangshaojun 111]# source /etc/profile  ///重置生效

    [root@wangshaojun 111]# echo $PATH 查看

    3.修改系统的bash系统配置文件

    目录的位置在

    [root@wangshaojun 111]# vim /etc/bashrc

    修改bashrc里面的ps1变量

    [root@wangshaojun 111]# echo $PS1
    [u@h W]$
    [root@wangshaojun 111]# PS1='[u@h w]$ '
    [root@wangshaojun22:51:02 /111]#

    修改回来就是把 ' ' 'w'改为'W'

    [root@wangshaojun22:51:02 /111]# PS1='[u@h W]$ '
    [root@wangshaojun 111]# echo $PS1
    [u@h W]$

    更改umask值

    [root@wangshaojun 111]# vim /etc/profile.d/umask.sh

       umask 0012

      ~
      ~

      :wq

    [root@wangshaojun 111]# source /etc/profile

    [root@wangshaojun 111]# umask
    0012

    最后再按上述改回0022,重置生效。查看umask

    //////////////////////////////////////////////////////////////////////////////////////////

    用户修改环境变量配置文件就切换到该用户然后修改 

    先切换用户

    [root@wangshaojun 111]# cd
    [root@wangshaojun ~]# ls -a .

    .bash_profile   

    用户定义环境变量

    .bashrc

    用户定义别名

    ///////////////////////////////////////////////////////////////////////////////////////////////

    总结:vim /etc/profile.d/**.sh 修改全局参数的变量  source /etc/profile 变量重启生效 

    用户变量切换到用户下修改

  • 相关阅读:
    swagger在线文档配置
    SpringBoot中使用Shiro和JWT做认证和鉴权
    Java web基础
    spring boot基础
    spring MVC基础
    IDEA破解(自动重置试用期)
    Linux常用jar包启动停止脚本sh命令
    Docker Desktop 容器与镜像的保存和导入
    字符串有长度限制吗
    Thyemleaf报错: Method call: Attempted to call method *** on null context object
  • 原文地址:https://www.cnblogs.com/wangshaojun/p/4964676.html
Copyright © 2011-2022 走看看