獲取LINUX系統資訊(how to get system info in linux)




以下命令列表,提示和資訊是我翻譯過來的.使用這些命令可以很快的取得您的系統資訊.


一般性的系統資訊

提示:很多硬體資訊命令一定要使用root管理員才可以執行,或者使用管理員執行可以獲得更多資訊.


運行qtparted 或者GParted 獲得硬盤和分區資訊.並且使用KDiskFree和fdisk -l獲得全部分區資訊.


hardinfo – 非常好的工具,而且可以獲得詳細報告.


獲取一個硬體報告:


這個報告包含很多其他報告,一些已經列到這篇文章裏面.通過installation-report 安裝Synaptic 包,


在全屏的命令行下運行:
report-hw
或者
report-hw > hwreport (把結果保存到文件hwreport 裏)


sysinfo – 在命令行下運行,可以獲得不錯的效果.


hal-device-manager
kde-hal-device-manager
這些包可以安裝在Synaptic下. 當使用kde-hal-device-manager時.可以通過 KMenu > System > Device Manager 來安裝.


dmidecode -t memory (as root)這個工具顯示系統的DMI(Desktop Management Interface)報告,報告內容包括系統的所有硬體,例如BIOS的版本號等. dmidecode 不單單顯示系統的當前配置,還包括BIOS支援CPU速度,最大記憶體等資訊.
dmidecode | less (as root) BIOS 資訊和系統資訊 (使用空格換頁,使用q退出)


uname -a (系統版本號)
uname -m 系統版本 (i.e. – i686)
uname -r 系統核心版本號


lshw (as root) – 列印硬體列表; 可以要使用 lshw | less (使用空格換頁,使用q退出)
lshw-gtk (as root) –


lsb_release -a (發行版本的資訊)  (或者查看 /etc/lsb_release)

***在 RedHat Linux AS4, 顯示的內容為:
LSB Version:    :core-3.0-ia32:core-3.0-noarch:graphics-3.0-ia32:graphics-3.0-noarch
Distributor ID: RedHatEnterpriseAS
Description:    Red Hat Enterprise Linux AS release 4 (Nahant Update 2)
Release:        4
Codename:       NahantUpdate2


lspci (as root) (控制器等資訊) (非常好的報告;參數 -v 顯示詳細內容,參數 -vv 顯示非常詳細的內定)
lspci -tv (as root) 以樹的形式顯示
lsusb, lsusb -tv – 列出USB設備
lsmod (at root, 顯示系統已載入的核心模組. 或者使用lsmod | less)


/proc – 包含很多本地重要資訊,使用 cd /proc  && ls ,使用cat命令查看/proc下面的文件,例如:cpuinfo,devices,filesystems,meminfo,partitions,swaps,uptime,version等;也可以進入子目錄查看,例如 cd driver.
例子:
cat /proc/cpuinfo (或者在/proc下使用cat cpuinfo )
cat /proc/version (或者在/proc下使用 cat verson ) – 版本資訊
cat /proc/swaps (或者在/proc下使用 cat swaps ) 顯示所有交換區.


top – 即時地顯示Linux的進程; 系統的情況和被內核所管理的進程,還包括交換區使用情況;使用 Shift-f 來排序 (默認排序是 k – CPU 使用率)

ctrl-esc 在KDE環境下顯示進程列表

顯示正在運行的線程:
ps aux
ps -e


swapon -s 顯示記憶體交換區和對應的資訊
swapon -a 使得包含在/etc/fstab裏的全部交換區生效.


free (記憶體使用情況,以K單位)
free -m (記憶體使用情況,以M為單位).


df -h (顯示所有載入的文件系統的資訊, 全部用戶都有權查看)
df -hT (顯示所有載入的文件系統的資訊,並且顯示文件系統的類型, 全部用戶都有權查看)


du / -bh | more 詳細的顯示每個子目錄的使用情況,全部用戶都可以查看,使用空格換頁,使用q退出.
du -s /var/log/* – 顯示系統記錄/var/log所使用的空間


hdparm -t /dev/hda (as root) – 測試並顯示 hda 的性能


相關時間命令:
date
uptime


fdisk -l 顯示所有硬碟上面的分區資訊.


/etc/fstab (這個文件包含文件系統的配置)內容一般為:
LABEL=/                 /                       ext3    defaults        1 1
none                    /dev/pts                devpts  gid=5,mode=620  0 0
none                    /dev/shm                tmpfs   defaults        0 0
LABEL=/home             /home                   ext3    defaults        1 2
LABEL=/home1            /home1                  ext3    defaults        1 2
none                    /proc                   proc    defaults        0 0
none                    /sys                    sysfs   defaults        0 0
/dev/sda5               swap                    swap    defaults        0 0



how to get cpu information on Linux machine

Hi,

I want to display cpu information like model number, vender information, and how many cpu’s are there in the system (Linux machine)

Is there any system call ? or /proc/cpuinfo is the only way

And also how get information regarding controllers and adapters installed on system(Linux machine) using any system call



Thanks and regards
laxmi

 

re:

cat /proc/cpuinfo
cat /proc/meminfo
dmesg
lspci

or

 


/usr/sbin/./x86info -a

Eclipse Profiler Plugin

Eclipse Profiler Plugin

This is a plugin for the Eclipse platform which allows java code profiling. Project

License

CPL.

 

General note

1.) if you run the remote profiler, the filter settings      in the eclipse environment are not taken into account.      Instead you must provide the filter settings in the      start command of your application server. You do this      by adding an environment variable __PROFILER_PACKAGE_FILTER      to the startup command of your aplication, see below.  2.) Setting up the profiler package filters (in general)      You must define the environment variable __PROFILER_PACKAGE_FILTER      as shown below in the examples for tomcat, jboss, weblogic and      resin.       General important Note:      The environment variable contains following parts:            the application starting class (__A__)      inclusion filters              (__P__)      exclusion filters              (__M__)            You must provide exactly one starting class, but you      can have multiple inclusion and exclusion filters.       The parts MUST be separated by the OS specific      path.separator, i.e. ":" for unix or "$$" for      WINDOWS platforms)       example package filter setting for WINDOWS: -D__PROFILER_PACKAGE_FILTER=__A__org.apache.catalina.startup.Bootstrap;__M__sun.;__P__my.company.classes.         example package filter setting for UNIX/LINUX: -D__PROFILER_PACKAGE_FILTER=__A__org.apache.catalina.startup.Bootstrap:__M__sun.:__P__my.company.classes.         In the examples below we provide the WINDOWS style. Please      take care to use the LINUX/UNIX style if that aplies to you.             

Win32 installation

Copy ProfilerDLL.dll from root plugin folder into bin folder of your JRE installation. You can skip this step, plugin will ask you and copy DLL into your JRE\BIN when you will start profiling local application inside of Eclipse first time. It will also check, that you have in JRE\BIN same DLL as in plugin directory.

Linux installation

Profiler has native part compiled with gcc 3.2, but if you have old gcc or libraries you can build native part yourself. Extract files from native\profiler_linux.tgz and look at script "m". This is example of compilation script. Change it as needed for you OS.
See also profile_cpu/profile_heap for examples of start line for cpu and heap profiling and r_cpu/r_heap as example how to use them.

Usage

Profiler plugin creates additional kind of launch configuration in Run menu. Profiler tab allows the user to define packages which shouldn’t be instrumented, thus, all time usage will be referred to calling methods.
You can specify refresh rate, i.e. how often plugin will read statistics from prolifing JVM.
You can also set method, how to get time of enter in method and leave. There are two methods: fast, but usefull only if you have one active thread, which tries to use all CPU; or slow, which use JVMPI function GetCurrentThreadCpuTime() and allows detect how much of CPU was used by thread. However with this method profiled program runs about 3 times slower than with fast method.


Fig. 1. Launch configuration.

 

Profiler supports inclusive (grren) and exlusive (red) filters. You can noy only specify what packages should be excluded from instrumentation, but also what packages should be included. Usefull, if you want to profile only your own classes. You can move filters up and down using buttons or drag and drop.


Fig. 1.1. Drag filters.

 

Plugin allows remote profiling with "Remote Profiler" launch configuration. Notice, that remote profiling is supported only in "run" mode, i.e. when you create launch configuration using "Run|Run…" menu item.
You need to start remote application with special switches like: java -XrunProfilerDLL -Xbootclasspath/a:jakarta-regexp.jar;profiler_trace.jar;commons-lang.jar -D__PROFILER_PACKAGE_FILTER=__M__sun.;__M__com.sun. -D__PROFILER_USE_PACKAGE_FILTER=1 Here __M__ prefix used for exclusive filter, __P__ can be used for inclusive filter. And you should use __A__ for class with method "main".


Fig. 2. Remote launch configuration.

 

Tomcat CPU profiling

Profiler was tested with jakarta-tomcat-4.1.12. Add after lines in catalina.bat:
set _EXECJAVA=%_RUNJAVA%
set MAINCLASS=org.apache.catalina.startup.Bootstrap
set ACTION=start
set SECURITY_POLICY_FILE=
set DEBUG_OPTS=
set JPDA=
following line:
set JAVA_OPTS=-XrunProfilerDLL:1 -Xbootclasspath/a:jakarta-regexp.jar;profiler_trace.jar;commons-lang.jar -D__PROFILER_PACKAGE_FILTER=__A__%MAINCLASS%;__M__sun.;__M__com.sun.;__M__java.;__M__javax.;__M__org.apache. -D__PROFILER_TIMING_METHOD=1
Then copy jar’s: commons-lang.jar jakarta-regexp.jar profiler_trace.jar to bin directory of tomcat. Now you can start tomcat using startup.bat and it will gather statistics for you. Next step is configuring Eclipse. You should create remote launch configuration and set host address as needed. This is all. Launch it, plugin will connect to your Tomcat and show you some statistics.

Tomcat heap profiling

Profiling heap is almost same as CPU profiling, but you should use following line:
set JAVA_OPTS=-XrunProfilerDLL:3,10,0 -D__PROFILER_PROFILE_HEAP=1 -Xbootclasspath/a:jakarta-regexp.jar;profiler_trace.jar;commons-lang.jar -D__PROFILER_PACKAGE_FILTER=__A__%MAINCLASS%;__M__ -D__PROFILER_TIMING_METHOD=1

JBoss profiling

Profiler was tested with jboss-3.0.6_tomcat-4.1.18. Add following line in your bin/run.bat (directly after echo off):
set JAVA_OPTS=-XrunProfilerDLL:1 -Xbootclasspath/a:jakarta-regexp.jar;profiler_trace.jar;commons-lang.jar -D__PROFILER_PACKAGE_FILTER=__A__org.jboss.Main;__M__sun.;__M__com.sun.;__M__java.;__M__javax. -D__PROFILER_TIMING_METHOD=1
Then copy jar’s: commons-lang.jar jakarta-regexp.jar profiler_trace.jar to bin directory of JBoss. Now you can start JBoss using run.bat and it will gather statistics for you. Next step is configuring Eclipse. You should create remote launch configuration and set host address as needed. This is all. Launch it, plugin will connect to your JBoss and show you some statistics.

WebLogic profiling

Profiler was tested with WebLogic 8.1, installed in "c:/bea". WebLogic has its own JRE’s, so you will need to copy ProfilerDLL.dll manually to C:\bea\jdk141_02\jre\bin. For profiling examples, change file C:\bea\weblogic81\samples\domains\examples\startExamplesServer.cmd, line where JAVA_OPTIONS is defined:
set JAVA_OPTIONS=-XrunProfilerDLL:1 -Xbootclasspath/a:jakarta-regexp.jar;profiler_trace.jar;commons-lang.jar -D__PROFILER_PACKAGE_FILTER=__A__weblogic.Server;__M__sun.;__M__com.sun.;__M__java.;__M__javax.;__M__weblogic. -D__PROFILER_TIMING_METHOD=1
Then copy jar’s: commons-lang.jar jakarta-regexp.jar profiler_trace.jar to "C:\bea\weblogic81\samples\domains\examples". Now you can start WebLogic examplex using startExamplesServer.cmd, or shortcut in Windows menu, and it will gather statistics for you. Next step is configuring Eclipse. You should create remote launch configuration and set host address as needed. This is all. Launch it, plugin will connect to your WebLogic and show you some statistics.

Resin profiling

Profiler was tested with Resin-ee 2.1.10. Create batch file with following content in "bin":
httpd.exe -J-XrunProfilerDLL:1 -Xbootclasspath/a:c:/prof/jakarta-regexp.jar;c:/prof/profiler_trace.jar;c:/prof/commons-lang.jar -D__PROFILER_PACKAGE_FILTER=__A__com.caucho.server.http.HttpServer;__M__sun.;__M__com.sun.;__M__java.;__M__javax. -D__PROFILER_TIMING_METHOD=1
Then create directory "prof" in disc "C" and copy jar’s: commons-lang.jar jakarta-regexp.jar profiler_trace.jar. Now you can start your batch file and it will gather statistics for you. Next step is configuring Eclipse. You should create remote launch configuration and set host address as needed. This is all. Launch it, plugin will connect to your Resin and show you some statistics.

Options

Profiler supports several options via -DXXX.

Options Description
__PROFILER_PACKAGE_FILTER Contains list of packages to include or exclude.
Here __P__ – inclusive pattern, __M__ – exclusive pattern.
And __A__ – application start class.
Examples:
Include only ru.* and de.* packages: __P__ru.;__P__de.
Exclude system packages: __A__org.jboss.Main;__M__sun.;__M__com.sun.;__M__java.;__M__javax.
If at least one inclusive pattern used, only classes accepted by inclusive patterns will be instrumented.
__PROFILER_TIMING_METHOD Specifies timing method – how to measure elapsed time.
0 – fast, System.currentTimeMillis(), good for application without sleeps and waits.
1 – precise, thread aware, slow, good for multithreaded applications.
2 – sampling profiling, very fast, good for long runned processes.
__PROFILER_PROFILE_HEAP 1, if HEAP profiling should be used.
__PROFILER_AUTO_START 0 – don’t start automatically.
1 (default) – start automatically.
__PROFILER_START_ON_METHOD Start method name. When applications tries to enter in this method profiling starts (see __PROFILER_AUTO_START, it should be 0).
Example: -D__PROFILER_START_ON_METHOD=ru.nlmk.train.Main.mainLoop
__PROFILER_PAUSE_ON_METHOD 1, if you need pause profiling when __PROFILER_START_ON_METHOD leaved.
__PROFILER_INSTRUMENT_SYSTEM_CLASSES 1, if you need instrument additional system classes, like java.lang.String, etc. Expensive!
__PROFILER_WAIT_FRONTEND_CONNECT 1, if you need to wait, until frontend (plugin) will connect. (0 by default).

CPU profiling

Profiler supports CPU profiling and basic function for heap profiling. The profiler collects invocation count and direct time statistics for every method. Direct time is the amount of time used by selected method for execute. Also a total time value displayed in calling tree for selected thread. The total time means a time used by selected method and by all the methods it had called.

Only instrumentation profiling method is supported because of its precise. The overhead expenses reflects at speed decreasing app. 5 times to normal.

How it works

The profiler subscribes for JVPMI event JVMPI_EVENT_CLASS_LOAD_HOOK which called during every class loading. The profiler modifies loading byte-code by adding profiler’s method call "enter" in the beginning of the every method of loading class and at the end of it – "leave". "Enter" profiler’s method notes the time of entering to profiling method. "Leave" makes method leaving timestamp and calculates a difference between enter and leave timestamps. This difference means total time for this method call. Direct time calculates as total time of this method minus total time of the all methods called by it. The profiles makes some time corrections for the time spent by profiler.

The profiler implemented as an Eclipse perspective with following views: Threads, Packages, Classes, Methods, Thread methods, Thread call tree, Heap.

Threads.
Shows a list with all threads (alive or dead) in the current process. Here you can pause/resume refreshing of statistics in views, pause/resume all threads in profilied program, clear all statistics or run GC in profiled JVM.


Fig. 3. Threads View.

 

Call graph.
Profiler uses Draw2D for displaying call graph of thread. All methods shown in several columns, column depends on level, on which this method was called. Inside one column methods sorted by direct time used. Each node in graph has color from red to dark gray, depending on direct time. Methods with maximum time use have red color, and methods, which almost don’t use time, have grey color. Each method has hint with detailed information. You can double click on method to open it in editor.
Lines between method present call from source method to target. Lines from one level to directly next have black color, to next – blue, inside one level – red, and from backward calls – green. Width of line depeneds on how much of time use in this call.


Fig. 3.1. Call graph.
You can also see hit for call.
Fig. 3.2. Call hint.
As you can see, full graph looks fairly complex, but you can select part of it. Press mouse on some method and select then button "Show callers", "Show calles" or "Show caller and callees". You can see something like this:
Fig. 3.3. Callers.

Fig. 3.4. Callees.

Fig. 3.5. Callers and callees.
You can double click on call line for opening editor with source method with highlighting places, where it calls target method.
Fig. 3.6. Show calls.

 

Packages.
Shows a list with all methods with class hierarchy from package. This allows to determine packages which used the most of CPU time. In this view (and in Classes and Methods views also) the user can see in gray color the methods with unmodified parameters since last update. The user can hide such kind of methods by applying appropriate filters.
Here:
Name – name of package/class/method
Inv. – invocation count
% – percent of all invocations
Time – direct time used
% – percent of total time
Time/Inv. – average time used for one invocation
Total time – total time used directly by method and by all methods it calls
Inst. time – time used for instrumentation of class


Fig. 4. Packages View.

 

You can add package or class to filter by pressing right mose button on element in table and selecting menu item. Filter can be added to launch configuration filter (will be used in next profiling, if you will active it) or to view filters (will be activated right now).


Fig. 4.1. Add filter.

 

Classes.
Shows a list of all class methods with method hierarchy from class. This allows to determine classes with the most CPU time usage.


Fig. 5. Classes View.

 

Filters.
Allows to define which kind of methods can be shown.


Fig. 6. Filters.
You can save configured name patterns (inclusive or exalusive) with some name and description, then you will able to select them in check list box.
Fig. 6.1. New filter.
Later you can change this user defined filter.
Fig. 6.2. Edit filter.

 

Methods.
Shows the statistics for all methods of the current process.


Fig. 7. All Methods View.

 

Thread methods.
Shows methods statictics for thread selected in Threads View.


Fig. 8. Thread Methods View.

 

Thread tree.
Shows a methods invocation tree for thread selected in Threads View. Here red square used for highlighted methods (from thread methods context menu) and green dot used for all other methods.


Fig. 9. Thread Tree View.

 

Inverted thread tree.
Shows a methods invocation tree for thread selected in Threads View starting from leaves. This allows you fastly detect, that some leaf method uses much of total time and see, what methods it is called.


Fig. 9.1. Inverted thread Tree View.

 

Heap.
Shows heap usage graph: total (green), used (blue) and free (yellow) heap.

Heap View.
Fig. 10. Heap View.

 

Here is an overall view of the profiler perspective. You can see a method HashMap.put opened in source code editor with highlighted lines of code which has the maximum hit count (size of annotation depends on hit count). You can open source code editor by choosing menu item "Open method in editor" in context menu.


Fig. 11. Perspective.

WYSIWYG 網頁線上編輯器比較表


在 OpenSource 的 WYSIWYG Editor 當中,早期最多人使用的 HTMLArea 由於原開發團隊進度緩慢,Bug 也很多,造成不少人想跳槽。


這裡有一份幾乎涵蓋所有 WYSIWYG 線上編輯器比較表:


http://www.geniisoft.com/showcase.nsf/WebEditors


OpenSource 跟商用的都有。不過這份資料還是有點小錯誤,像 FCKeditor 的網址也不正確,這些我會回報過去,相信應該很快就可以更正過來。


在 OpenSource 當中,目前風評較佳的是 TinyMCEFCKEditorXinha


其中 TinyMCE 最受大多數人青睞,速度快又穩定,目前也逐漸提供 Safari 的支援。然而 TinyMCE 除了 HTMLArea 原有的功能外,也導入了 Image Manager + Editor ,可以線上管理及簡單的修改圖片。

至於商用的就沒有研究了,有興趣的人可以去玩玩看囉。^^

NOD32最新升级ID

Username: AV-6656986
Password: bk6soccp0o

Username: AV-6383678
Password: hsyfc640um

Username: AV-6294494
Password: 53u6p5gndm

Username: AV-6171271
Password: w55beid6gj

Username: AV-6588188
Password: 2dtb6t8pgf

Username: AV-6697455
Password: wonn9hqfw6

UserName: AV-6504753
PassWord: swhmfw9i0g

Username: AV-6670664
Password: 17s9x8bgfk

UserName: AV-6383678
PassWord: hsyfc640um

Username: AV-6661155
Password: jeay9be0ix

優化resin

修改RESIN_HOME/bin/wraper.pl

 

 

$JAVA_ARGS=”-server -verbose:gc -Xdebug -Xloggc:gc.log -Djava.awt.headless=true -XX:PermSize=128M -XX:+UseConcMarkSweepGC -Xms512m –
Xmx512m”;

 

仲有

 

$DEFAULT_STACK_SIZE=”-Xss512k”;

as4安裝JDK5/JDK6

由於AS4自帶嘅JDK系1.4

而我開發的系統使用JDK5,所以要重新安裝JDK5.

 

先下載JDK.http://java.sun.com

 

解壓到 /usr/lib/jdk1.6.0_01/

 

建立連接 ln -s /usr/lib/jdk1.6.0_01 /jdk

修改 vi /etc/profile

 

 

export JAVA_HOME=”/jdk/”

export RESIN_HOME=”/resin/”

export JAVA_BIN=”/jdk/bin/”

export PATH=$PATH:$JAVA_HOME/bin

export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

 

 

完成!

Resin多域名绑定 one resin two hosts


Resin多域名绑定



需求:
group.XXX.com
XXX.group.XXX.com
都指向同一系统


 <host id=”group.aaa.com”>
 <host-alias-regexp>([a-zA-Z0-9.]+)roup\.([^.]+)\.com</host-alias-regexp>
 <host-name>${host-alias-regexp.regexp[1]}roup.${host-alias-regexp.regexp[2]}.com</host-name>
 <root-directory>.</root-directory>
 <web-app id=”/” document-directory=”e:\group_aaa”/>
 </host>
 
启动Resin后,访问
1234567
 http://a.group.aaa.com/
 http://group.aaa.com/
 http://group.bbb.com/
 http://a.group.bbb.com/
 


都能访问到同一系统。


本站使用的域名是
<host id=”strongd.net”>
  <host-alias-regexp>([a-zA-Z0-9.]+).strongd\.net</host-alias-regexp>
  <host-name>${host-alias-regexp.regexp[1]}.strongd.net</host-name>
  <root-directory>.</root-directory>


绑定指定的几个域名的方法也一样.例如只允许abc.cn/abc.com,gofor.cn,gofor.com,yes001.cn.yes001.com访问的话.可以这样写:


 <host id=”aaa.com”>
 <host-alias-regexp>([a-zA-Z0-9.]+).(abc|gofor|yes001+)\.(com|cn)</host-alias-regexp> 就在这个地方(abc|gofor|yes001+)\.(com|cn)
 <host-name>${host-alias-regexp.regexp[1]}.${host-alias-regexp.regexp[2]}.${host-alias-regexp.regexp[3]}</host-name> 使用了三个正则表达式,
 <root-directory>.</root-directory>
 <web-app id=”/” document-directory=”e:\group_aaa”/>
 </host>

Error * Expected format ‘3’ of repository; found format ‘5’

What gives this error?

I’m using svnserve.exe on windows (svn-win32-1.3.2). When trying to connect with TortoiseSVN (1.4.3, Build 8645) I get the error.

The repository has been copied from another machine, where it ran fine, possibly using an older version of the svn server.

TIA!

 

 

 

Hi there,

exactly what you’ve written. you copied the repository from a machine where Subversion 1.4 has been running. you shouldn’t simply copy the repos.

Just do an svnadmin dump of the source machine and make an svnadmin load on your destination machine.



Subversion’s repository database schema has changed occasionally during development. Old repositories, created with a pre-1.0 development version of Subversion, may require the following operation when upgrading. If a schema change happens between Subversion releases X and Y, then repository administrators upgrading to Y must do the following:



  1. Shut down svnserve, Apache, and anything else that might be accessing the repository.
  2. svnadmin dump /path/to/repository > dumpfile.txt , using version X of svnadmin.
  3. mv /path/to/repository /path/to/saved-old-repository
  4. Now upgrade to Subversion Y (i.e., build and install Y, replacing X).
  5. svnadmin create /path/to/repository, using version Y of svnadmin.
  6. svnadmin load /path/to/repository < dumpfile.txt , again using version Y of svnadmin.
  7. Copy over hook scripts, etc, from the old repository to the new one.
  8. Restart svnserve, Apache, etc.