linux命令

来源:互联网 发布:c语言编程技巧 编辑:程序博客网 时间:2024/06/16 05:12
2、在Linux新建一个用户,命令如下:


     #useradd username 
3、为username设置密码,命令如下:


  #passwd username 
     #设置密码为:password 
4、切换到新建的用户命令:


 #su - username 
   $ su - username 
   password 输入密码password 
回车后显示$表示创建用户成功 


whoami


5:linux下java安装路径:


1:whereis java
2:如果仅仅想知道java执行路径在那里的话 用which java就可以了
 


三、Linux系统安装JDK


  1、准备JDK安装文件,同样可以在Sun官网进行下载,下载前选择好相应的系统版本,可以下载bin文件也可以下载rpm包文件。我这里安装 "jdk-1_6_0_17-linux-i586.bin" 此版本。


 


  2、登陆Linux服务器(建议使用root用户,可使用SSH工具操作Linux,SSH工具的File Transfer上传文件),上传文件至服务器目录,如:"/home/appuser/"。


 


  3、将文件复制到需要安装的目录之下。命令:


  cp /home/appuser/jdk-1_6_0_17-linux-i586.bin /usr/local/jdk-1_6_0_17-linux-i586.bin 


  4、到JDK所在目录(cd /usr/local/),赋予 jdk-1_6_0_17-linux-i586.bin 文件可执行权限。命令:


  chmod 777 jdk-1_6_0_17-linux-i586.bin 


  5、执行文件,安装JDK。命令:


  ./jdk-1_6_0_17-linux-i586.bin 


  6、同意Sun协议,完成安装,会生成目录 "jdk1.6.0_17"。若没有错误,到此则JDK安装完成。可以使用命令(mv jdk1.6.0_17 jdk)将该目录名更改为你需要的,例如 "jdk"。


 


四、Linux系统Java环境变量配置


  1、/etc/profile 文件就是Linux系统配置文件,为保险起见,先备份系统配置文件(cp /etc/profile /etc/profile-bak)。


 


  2、进入/etc/目录(cd /etc/)使用vi工具编辑profile文件(使用 vi profile 命令进入编辑器命令模式,输入"i"开始插入内容,将光标移动至目标位置,输入完毕之后按Esc退出编辑模式回到命令模式,命令模式下输入":wq!"保存退出),在末尾输入如下内容(Linux系统中的分隔符为":"):


  export JAVA_HOME=/usr/local/jdk  export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar  export PATH=$JAVA_HOME/bin 


  3、保存完毕之后使配置生效,命令:


  source /etc/profile 


  4、验证版本


appuser@usm:~> java -versionjava version "1.6.0_17"Java(TM) SE Runtime Environment (build 1.6.0_17-b04)Java HotSpot(TM) 64-Bit Server VM (build 14.3-b01, mixed mode)appuser@usm:~> 




appuser@usm:~> java
Usage: java [-options] class [args...]           (to execute a class)   or  java [-options] -jar jarfile [args...]           (to execute a jar file)where options include:    -d32          use a 32-bit data model if available    -d64          use a 64-bit data model if available    -server       to select the "server" VM                  The default VM is server.                      -cp <class search path of directories and zip/jar files>    -classpath <class search path of directories and zip/jar files>                  A : separated list of directories, JAR archives,                  and ZIP archives to search for class files.    -D<name>=<value>                  set a system property    -verbose[:class|gc|jni]                  enable verbose output    -version      print product version and exit    -version:<value>                  require the specified version to run    -showversion  print product version and continue    -jre-restrict-search | -jre-no-restrict-search                  include/exclude user private JREs in the version search    -? -help      print this help message    -X            print help on non-standard options    -ea[:<packagename>...|:<classname>]    -enableassertions[:<packagename>...|:<classname>]                  enable assertions    -da[:<packagename>...|:<classname>]    -disableassertions[:<packagename>...|:<classname>]                  disable assertions    -esa | -enablesystemassertions                  enable system assertions    -dsa | -disablesystemassertions                  disable system assertions    -agentlib:<libname>[=<options>]                  load native agent library <libname>, e.g. -agentlib:hprof                    see also, -agentlib:jdwp=help and -agentlib:hprof=help    -agentpath:<pathname>[=<options>]                  load native agent library by full pathname    -javaagent:<jarpath>[=<options>]                  load Java programming language agent, see java.lang.instrument    -splash:<imagepath>                  show splash screen with specified imageappuser@usm:~>
 




appuser@usm:~> javacUsage: javac <options> <source files>where possible options include:  -g                         Generate all debugging info  -g:none                    Generate no debugging info  -g:{lines,vars,source}     Generate only some debugging info  -nowarn                    Generate no warnings  -verbose                   Output messages about what the compiler is doing  -deprecation               Output source locations where deprecated APIs are used  -classpath <path>          Specify where to find user class files and annotation processors  -cp <path>                 Specify where to find user class files and annotation processors  -sourcepath <path>         Specify where to find input source files  -bootclasspath <path>      Override location of bootstrap class files  -extdirs <dirs>            Override location of installed extensions  -endorseddirs <dirs>       Override location of endorsed standards path  -proc:{none,only}          Control whether annotation processing and/or compilation is done.  -processor <class1>[,<class2>,<class3>...]Names of the annotation processors to run; bypasses default discovery process  -processorpath <path>      Specify where to find annotation processors  -d <directory>             Specify where to place generated class files  -s <directory>             Specify where to place generated source files  -implicit:{none,class}     Specify whether or not to generate class files for implicitly referenced files   -encoding <encoding>       Specify character encoding used by source files  -source <release>          Provide source compatibility with specified release  -target <release>          Generate class files for specific VM version  -version                   Version information  -help                      Print a synopsis of standard options  -Akey[=value]              Options to pass to annotation processors  -X                         Print a synopsis of nonstandard options  -J<flag>                   Pass <flag> directly to the runtime systemappuser@usm:~>


  至此,Windows、Linux系统下JDK安装,Java环境变量配置全部完成。



aa.sh


#!/bin/sh


# The following three lines have been added by UDB DB2.
if [ -f /db/home1/db2inst2/sqllib/db2profile ]; then
    . /db/home1/db2inst2/sqllib/db2profile
fi






export PATH=/usr/IBM/WebSphere/AppServer/java/bin:$PATH
export BILLINGDIR=/adcoms/bi
export LIBPATH=/db/home1/db2inst2/sqllib/lib64:$LIBPATH
export CLASSPATH=/db/home1/db2inst2/sqllib/java/db2jcc.jar:$CLASSPATH
java  -Xms50m -Xmx1024m -classpath $BILLINGDIR/lib/SI_CODE.jar:$BILLINGDIR/lib/db2jcc.jar:$BILLINGDIR/lib/db2jcc_license_cu.jar:$BILLINGDIR/lib/db2jcc_license_cisuz.jar:$BILLINGDIR/lib/log4j.jar:$BILLINGDIR/lib/hibernate3.jar:$BILLINGDIR/lib/dom4j-1.6.1.jar:$BILLINGDIR/lib/commons-logging-1.0.4.jar:$BILLINGDIR/lib/commons-collections-3.1.jar:$BILLINGDIR/lib/cglib-2.1_2jboss.jar:$BILLINGDIR/lib/ehcache-1.1.jar:$BILLINGDIR/lib/jta.jar:$BILLINGDIR/lib/xml-apis.jar:$BILLINGDIR/lib/aiismg.jar:$BILLINGDIR/lib/ant-1.6.2-stripped.jar:$BILLINGDIR/lib/antlr-2.7.5H3.jar:$BILLINGDIR/lib/asm.jar:$BILLINGDIR/lib/asm-attrs.jar:$BILLINGDIR/lib/bsh-1.3.0.jar:$BILLINGDIR/lib/clover.jar:$BILLINGDIR/lib/commons-attributes-api.jar:$BILLINGDIR/lib/commons-attributes-compiler.jar:$BILLINGDIR/lib/commons-beanutils-1.7.0.jar:$BILLINGDIR/lib/commons-collections.jar:$BILLINGDIR/lib/commons-digester-1.5.jar:$BILLINGDIR/lib/commons-fileupload-1.0.jar:$BILLINGDIR/lib/commons-lang-2.1.jar:$BILLINGDIR/lib/commons-logging.jar:$BILLINGDIR/lib/commons-validator.jar:$BILLINGDIR/lib/itext-1.3.jar:$BILLINGDIR/lib/jaxen-1.1-beta-4.jar:$BILLINGDIR/lib/jdbc2_0-stdext.jar:$BILLINGDIR/lib/jstl-1.1.2.jar:$BILLINGDIR/lib/junit-3.8.1.jar:$BILLINGDIR/lib/poi-2.5.1.jar:$BILLINGDIR/lib/standard-1.0.6.jar:$BILLINGDIR/lib/xercesImpl.jar com.bmcc.adc.si.back.svcchart.initDate.LoadTsiStatSvcSummary 0