1.编写desktop entry文件
Linux KDE 和 Linux GNOME 桌面系统都使用 Desktop Entry 文件标准来描述程序启动配置信息,Desktop Entry 文件以".desktop"为后缀名,通常被存放在 /usr/share/applications和/opt/gnome/share/applications 等目录下,比如编辑/usr/share/applications/eclipse.cdt,内容如下
[Desktop Entry] Name=Eclipse Comment=Eclipse SDK Icon=/home/pc01/eclipse/icon.xpm Exec=/home/pc01/eclipse/eclipse Terminal=false Type=Application Categories=Application;Development Encoding=UTF-8
5.cppncss用法
cppncss -r -v -x -k -f=report.xml <sources>
6.编写sh文件,保存为genreport.sh,修改权限chmod u+x genreport.sh#!/bin/sh #gcov.sh #run gcov report echo "clean MASServer" "/usr/bin/gmake" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .clean-conf rm *.gcov echo "make MASServer" "/usr/bin/gmake" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf BuildPath=./build/Debug/GNU-Linux-x86 TinyXML=/home/pc01/Source/c++/tinyxml CPPCheckReport=cppcheckreport.xml CPPNCSSReport=cppncssreport.xml GCOVReport=gcovreport.xml GCOVRApp=/home/pc01/Source/gcovr RunPath=./dist/Debug/GNU-Linux-x86 if [ -r "$BuildPath" ]; then echo "Make Success" rm $CPPCheckReport > /dev/null echo "Make CPPCheck Report $CPPCheckReport" cppcheck -v --enable=all --xml -I $TinyXML ./ 2> $CPPCheckReport rm $CPPNCSSReport > /dev/null echo "Make CPPNCSS Report $CPPNCSSReport" cppncss -r -v -x -k -f=$CPPNCSSReport ./ echo "Run Program" $RunPath/masserver > /dev/null rm $GCOVReport > /dev/null echo "Make GCovr" $GCOVRApp -x -r . > $GCOVReport else echo "Make Fail!" fi
/etc/init.d/mysql stop启动mysql
/etc/init.d/mysql start拷贝mysql配置 cp /usr/share/doc/MySQL-server-5.5.17/my-large.cnf /etc/my.cnf vi /etc/my.cnf 在[client]下面加上 default-character-set = utf8 在[mysqld]下面加上 character-set-server=utf8 init_connect = 'SET NAMES utf8' mysql创建sonar数据库
CREATE DATABASE sonar CHARACTER SET utf8 COLLATE utf8_general_ci;创建一个sonar用户:
grant all privileges on sonar.* to 'sonar'@'localhost' identified by 'sonar'; flush privileges; 修改sonar配置conf/sonar.properties
sonar.jdbc.url: jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8 sonar.jdbc.driver: com.mysql.jdbc.Driver sonar.jdbc.validationQuery: select 1 修改maven配置文件/conf/settings.xml
<profile> <id>sonar</id> <activation> <activeByDefault>true</activeByDefault> </activation> <properties> <sonar.jdbc.url>jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8</sonar.jdbc.url> <sonar.jdbc.driverClassName>com.mysql.jdbc.Driver</sonar.jdbc.driverClassName> <sonar.jdbc.username>sonar</sonar.jdbc.username> <sonar.jdbc.password>sonar</sonar.jdbc.password> <sonar.host.url>http://127.0.0.1:9000</sonar.host.url> </properties> </profile>
启动sonar,登录用admin/admin完成
10.看libc版本
/lib/libc.so.6
[google64] name=Google - x86_64 baseurl=http://dl.google.com/linux/rpm/stable/x86_64 enabled=1 gpgcheck=1 gpgkey=https://dl-ssl.google.com/linux/linux_signing_key.pub执行sudo yum install google-chrome-beta
14.查看linux具体为32还是64位 file /sbin/init
18.查看 Linux程序的导入表函数
readelf -a XXX
19.查看通道信息可以翻页
readelf -a XXX | grep FUNC | less
20.快速找文件
locate XXX
Linux KDE 和 Linux GNOME 桌面系统都使用 Desktop Entry 文件标准来描述程序启动配置信息,Desktop Entry 文件以".desktop"为后缀名,通常被存放在 /usr/share/applications和/opt/gnome/share/applications 等目录下,比如编辑/usr/share/applications/eclipse.cdt,内容如下
[Desktop Entry] Name=Eclipse Comment=Eclipse SDK Icon=/home/pc01/eclipse/icon.xpm Exec=/home/pc01/eclipse/eclipse Terminal=false Type=Application Categories=Application;Development Encoding=UTF-8
2.gcov用法
3.chmod用法
chmod (u/g/o/a) (+/-/=) (权限) FileName/DirName
4.cppcheck用法
5.cppncss用法
cppncss -r -v -x -k -f=report.xml <sources>
6.编写sh文件,保存为genreport.sh,修改权限chmod u+x genreport.sh#!/bin/sh #gcov.sh #run gcov report echo "clean MASServer" "/usr/bin/gmake" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .clean-conf rm *.gcov echo "make MASServer" "/usr/bin/gmake" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf BuildPath=./build/Debug/GNU-Linux-x86 TinyXML=/home/pc01/Source/c++/tinyxml CPPCheckReport=cppcheckreport.xml CPPNCSSReport=cppncssreport.xml GCOVReport=gcovreport.xml GCOVRApp=/home/pc01/Source/gcovr RunPath=./dist/Debug/GNU-Linux-x86 if [ -r "$BuildPath" ]; then echo "Make Success" rm $CPPCheckReport > /dev/null echo "Make CPPCheck Report $CPPCheckReport" cppcheck -v --enable=all --xml -I $TinyXML ./ 2> $CPPCheckReport rm $CPPNCSSReport > /dev/null echo "Make CPPNCSS Report $CPPNCSSReport" cppncss -r -v -x -k -f=$CPPNCSSReport ./ echo "Run Program" $RunPath/masserver > /dev/null rm $GCOVReport > /dev/null echo "Make GCovr" $GCOVRApp -x -r . > $GCOVReport else echo "Make Fail!" fi
7.rpm安装
8.sonar+mysql+maven+tomcat
下载maven,配置环境变量
下载tomcat,安装后,配置环境变量
/etc/init.d/mysql stop启动mysql
/etc/init.d/mysql start拷贝mysql配置 cp /usr/share/doc/MySQL-server-5.5.17/my-large.cnf /etc/my.cnf vi /etc/my.cnf 在[client]下面加上 default-character-set = utf8 在[mysqld]下面加上 character-set-server=utf8 init_connect = 'SET NAMES utf8' mysql创建sonar数据库
CREATE DATABASE sonar CHARACTER SET utf8 COLLATE utf8_general_ci;创建一个sonar用户:
grant all privileges on sonar.* to 'sonar'@'localhost' identified by 'sonar'; flush privileges; 修改sonar配置conf/sonar.properties
sonar.jdbc.url: jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8 sonar.jdbc.driver: com.mysql.jdbc.Driver sonar.jdbc.validationQuery: select 1 修改maven配置文件/conf/settings.xml
<profile> <id>sonar</id> <activation> <activeByDefault>true</activeByDefault> </activation> <properties> <sonar.jdbc.url>jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8</sonar.jdbc.url> <sonar.jdbc.driverClassName>com.mysql.jdbc.Driver</sonar.jdbc.driverClassName> <sonar.jdbc.username>sonar</sonar.jdbc.username> <sonar.jdbc.password>sonar</sonar.jdbc.password> <sonar.host.url>http://127.0.0.1:9000</sonar.host.url> </properties> </profile>
启动sonar,登录用admin/admin完成
9.看程序libc版本
10.看libc版本
/lib/libc.so.6
11.解压bz2后缀文件
12.centos增加更新站点并下载chrome
[google64] name=Google - x86_64 baseurl=http://dl.google.com/linux/rpm/stable/x86_64 enabled=1 gpgcheck=1 gpgkey=https://dl-ssl.google.com/linux/linux_signing_key.pub执行sudo yum install google-chrome-beta
13.查看linux内核版本
14.查看linux具体为32还是64位 file /sbin/init
或者
getconf LONG_BIT查看相关.so是什么版本也可以 file XXX.so15.查看文件用了哪些库文件
16.看系统信息
17.安装deb文件
18.查看 Linux程序的导入表函数
readelf -a XXX
19.查看通道信息可以翻页
readelf -a XXX | grep FUNC | less
20.快速找文件
locate XXX
21解决cannot restore segment prot after reloc: Permission denied问题
22查找文件内容
find . | xargs grep "test"grep -c "test" *.h