etc profile環境變數配置解析

2021-05-23 06:05:09 字數 1439 閱讀 3924

與環境變數相關的檔案可能還會有/etc/bashrc等,不過這是shell變數,是區域性的,對於特定的shell器作用。/etc/profile是全域性的,適用於所有的shell.

profile檔案會告訴shell使用什麼語言,什麼shell,命令的搜尋路徑等等。

一些標準的環境變數:

shell 預設shell

lang 預設語言

path linux尋找命令的預設路徑,一般包括/bin,/usr/bin,/sbin,/usr/sbin,

/usr/x11r6/bin,/opt/bin,/usr/local/bin等。使用者可以自行新增,

如/home/bin等。

manpath man手冊的預設路徑

inputrc 預設鍵盤映象,詳見/etc/inputrc

bash_env bash shell的環境變數,通常在~/.bashrc中

display x視窗適用的控制台,display=:0對應於控制台f7,display=:1對應於控制

臺f8,display=server:0向遠端計算機傳送gui應用程式。

colorterm gui中的預設終端,通常是gnome-terminal.

user 自動設定當前登陸使用者的使用者名稱。

longname 通常設定為$user

mail 設定特定$usr的標準郵件目錄

hostname 設定為/bin/hostname的命令輸出

histsize 設定為history命令記住的命令數

例子:

#

# /etc/profile

##修改或新增path可以自定義命令的尋找路徑,如果你不想將可執行檔案新增到預設目錄中但又可以在終端中使用命

#令,那就改吧。

export path="/bin:/usr/bin:/sbin:/usr/sbin:/usr/x11r6/bin:/opt/bin:/usr/local/bin"

export manpath="/usr/man:/usr/x11r6/man"

export lesscharset="latin1"

export inputrc="/etc/inputrc"

export less="-r"

# locale settings (find your locale with ''locale -a'')

export lang="zh_cn" #修改這裡可以改變系統的預設使用語言

export lc_collate="c"

export columns lines

export ps1=''[/u@/h /w]/$ ''

export ps2=''> ''

umask 022

…………

# end of file

etc profile 環境變數

一 此檔案涉及系統的環境,即環境變數相關。這裡修改會對所有使用者起作用。etc profile會首先執行 etc profile.d 目錄下的所有 s 件。1.linux是乙個多使用者作業系統。使用者登入或切換 即login shell 啟動 時都有乙個專用的執行環境,但首先執行 etc profi...

etc profile環境變數配置解析

與環境變數相關的檔案可能還會有 etc bashrc等,不過這是shell變數,是區域性的,對於特定的shell器作用。etc profile是全域性的,適用於所有的shell。profile檔案會告訴shell使用什麼語言,什麼shell,命令的搜尋路徑等等。一些標準的環境變數 shell 預設s...

etc profile 全域性環境變數配置解析

與環境變數相關的檔案可能還會有 etc bashrc等,不過這是shell變數,是區域性的,對於特定的shell器作用。etc profile是全域性的,適用於所有的shell。profile檔案會告訴shell使用什麼語言,什麼shell,命令的搜尋路徑等等。一些標準的環境變數 shell 預設s...