zoukankan      html  css  js  c++  java
  • common commands on Linux

    #### Tibco ems admin commands

    show consumers topic=topic.sample
    show consumers queue="queuname"
    show connections user="username"

    #### sar

    sar -W 1 100 : check swap in/out statistics

    #### check java class version

    $ file ./org/apache/log4j/Appender.class
    ./org/apache/log4j/Appender.class: compiled Java class data, version 45.3
    Or alternatively, using javap from the JDK as @jikes.thunderbolt aptly points out:

    $ javap -v ./org/apache/log4j/Appender.class | grep major
    major version: 45
    And if you are relegated to a Windows environment without either file or grep

    > javap -v ./org/apache/log4j/Appender.class | findstr major
    major version: 45

    #### java

    ## to check if a 64 bit java

    java -d64

    java -d32

    #### jar

    ## Create jar file
    jar cvf test.jar 1.txt 2.txt

    or put 1.txt and 2.txt into test folder, then:

    jar cvf test.jar test/*

    ## extract jar file

    jar xf test.jar

    It will extract all the files from test.jar and keep all the current directory structure.

    so you will see:
    test/1.txt
    test/2.txt


    Suppose you want to extract the TicTacToe class file and the cross.gif image file. To do so, you can use this command:

    jar xf test.jar 1.txt

    then it will just extract 1.txt from test.jar and put it under test/1.txt.


    e.g. you have below jar and it's class file included in the jar:

    [lofutpd1@lonlx1060b01:~/release/UTP7.1.0/lib]$ /local/0/sw/java/jdk1.6.0_30/bin/jar tf reconciliation-common-UTP7.1.0.jar | grep DateTime
    com/nomura/fitp/reconciliation/DateTimeFormatFilter.class
    [lofutpd1@lonlx1060b01:~/release/UTP7.1.0/lib]$

    SOmetimes you want to replace that class file in order to test your new fix, you want to replace the class file with newly build class file, so you can do:

    /local/0/sw/java/jdk1.6.0_30/bin/jar uf reconciliation-common-UTP7.1.0.jar com/nomura/fitp/reconciliation/FloatValueFormatFilter.class com/nomura/fitp/reconciliation/DateTimeFormatFilter.class


    #### grep

    1. Only show the matched part
    ps -ef | grep service | grep [processUser] | grep -oh "processname=w*"

    2. Exclude pattern

    grep -v 'pattern'

    3. Case insensitive

    grep -i

    4. include the file name in the grep commands

    grep -n 'pattern' file /dev/null


    #### tar

    tar -cvjf a.tar a.html
    tar -xvjf a.tar

    -z : gzip(quicker but larger)
    -j : bzip2(slower but smaller)


    #### ls

    ls -lh : human readable size

    ls -sSl --block-size=M : sort by size and displayed in mega bytes

    ls -sSr --block-size=M : sort by size but displayed in the reverse order, and displayed in mega bytes

    use top together with free command:

    #### free
    free -g
    free -m


    #### du

    du -ah --max-depth=1 : not just directories but also files
    du -h --max-depth=1 : just directories

    #### wget

    wget to get the content of some web page

    e.g. wget http://hostname:/directory/filename.txt

  • 相关阅读:
    C#
    C#
    css
    css
    css
    css
    css
    Css
    Javascript
    ASP.NET MVC
  • 原文地址:https://www.cnblogs.com/glf2046/p/6510470.html
Copyright © 2011-2022 走看看