etc profile檔案解析

2021-05-26 02:19:24 字數 1417 閱讀 8988

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

etc profile檔案詳解

2 常在 etc profile檔案中修改環境變數,在這裡修改的內容是對所有使用者起作用的。3 如何新增環境變數。例如新增 name liheng 在profile檔案的最後新增如下內容export name liheng 變數值liheng可以加引號也可以不加,效果一樣。4 在profile檔案新...

etc profile環境變數配置解析

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