Linux C/C++計劃Shell命令大雜燴(1)

1, 請參見發行信息shell

    cat /etc/issuebash


2, 查看內核版本號網絡

   uname -r 查看內核版本號函數

   uname -p 查看處理器類型32bit/64bitspa

   uname -n 查看網絡主機名(or hostname)code


3,OpenJDK和JDK啥差異?component

   Oracle JDK is based on the OpenJDK source code. In addition, it contains closed-source components. 也就是說,OpenJDK去掉了JDK中涉及一些版權問題的API和源碼,功能比JDK少點。ip


4,父Shell、子Shell文檔

  當在運行一個Shell Script時,父Shell會依據Script程序的第一行#!以後指定的Shell程序開啓一個子Shell環境,而後在子Shell中運行此Shell Script。一旦子Shell中的Script運行完成,此子Shell隨即結束。回到父Shell中。不會影響父Shell本來的環境。子Shell環境擁有與父Shell一樣的環境變量、標準輸入、輸出、錯誤等。源碼


5, source命令做用?

      可以用help source查看幫助文檔。P.S. 點命令與source命令同樣,使用方法爲. filename [arguments]

      source: source filename [arguments]

              Execute commands from a file in the current shell.


Read and execute commands from FILENAME in the current shell.  The entries in $PATH are used to find the directory containing FILENAME.  If any ARGUMENTS are supplied, they become the positional parameters when FILENAME is executed.


    Exit Status:

    Returns the status of the last command executed in FILENAME; fails if FILENAME cannot be read.

  文件filename可以沒有運行權限。

  在當前shell中運行和在子shell中運行的差異是,後者定義的變量和函數在運行結束後就消失了,而前者卻可以保留下來。所以,若咱們改動了/etc/profile裏面的內容,如添加了環境變量。那麼假設要立刻生效的話,就必須使用source命令或者點命令在當前shell中運行一下。


6, 環境變量

    (1)查看所有環境變量:

      $ set

      

    (2)查看某個環境變量:

      $ echo "$PATH"


   (3)環境變量設置:

export ANT_HOME=/path/to/ant/dir

export PATH=${PATH}:${ANT_HOME}/bin:${JAVA_HOME}/bin

 (4) 持久化環境變量的文件:

     /etc/profile, 存放系統級環境變量的地方,對所有用戶有效。設置完以後需要又一次登陸才幹生效。

     ~/.bashrc, 存放當前用戶環境變量的地方,僅僅對當前用戶有效。

設置完以後僅僅需要又一次啓動shell。

     固然,上面介紹的source命令可以立刻生效。

相關文章
相關標籤/搜索