zoukankan      html  css  js  c++  java
  • Ubuntu 环境变量

    Ubuntu Linux系统包含两类环境变量:系统环境变量和用户环境变量。系统环境变量对所有系统用户都有效,用户环境变量仅仅对当前的用户有效。

    修改用户环境变量

    用户环境变量通常被存储在下面的文件中:

    • ~/.profile
    • ~/.bash_profile 或者 ~./bash_login
    • ~/.bashrc

    上述文件在Ubuntu 10.0以前版本不推荐使用。

    系统环境变量

    系统环境变量一般保存在下面的文件中:

    • /etc/environment
    • /etc/profile
    • /etc/bash.bashrc

    /etc/profile和 /etc/bash.bashrc在Ubuntu 10.0版本中不推荐使用。

    加入环境变量

    如想将一个路径加入到$PATH中,可以像下面这样做(修改/etc/profile):

    [bash]$ sudo nano /etc/profile[/bash]

    在里面加入:

    [bash]export PATH="$PATH:/my_new_path"[/bash]

    你可以自己加上指定的多个路径,中间用冒号隔开。环境变量更改后,在用户下次登陆时生效,如果想立刻生效,则可执行下面的语句:

    [bash]$source /etc/profile[/bash]

    需要注意的是,最好不要把当前路径”./”放到PATH里,这样可能会受到意想不到的攻击。

    其他文件的修改方式与此类似,需要注意的是/etc/environment不需要使用export设置环境变量,其他profile文件需要。

  • 相关阅读:
    poj 1579(动态规划初探之记忆化搜索)
    hdu 1133(卡特兰数变形)
    CodeForces 625A Guest From the Past
    CodeForces 625D Finals in arithmetic
    CDOJ 1268 Open the lightings
    HDU 4008 Parent and son
    HDU 4044 GeoDefense
    HDU 4169 UVALive 5741 Wealthy Family
    HDU 3452 Bonsai
    HDU 3586 Information Disturbing
  • 原文地址:https://www.cnblogs.com/ahuo/p/2596623.html
Copyright © 2011-2022 走看看