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命令可以立刻生效。

相关文章
相关标签/搜索