`
saphen
  • 浏览: 3651 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
最近访客 更多访客>>
社区版块
存档分类
最新评论

日常命令

 
阅读更多
Suse Linux
文件系统
 查找*.jar文件并复制到/home/test 目录
find . -name *.jar -exec cp '{}' /home/test ';'
 查找符合条件的xml文件并在其中查找字符串并打印出来
find . -name "geronimo-plugin.xml" -print -exec grep "geronimo-stax-api_1.0_spec" {} \;
 查找*.xml的文件然后对其执行dos2unix命令
find . -name "*.xml" -exec dos2unix {} \;
 查找并替换,找到password并替换为pwd
find . -name "*" -print | xargs perl -pi -e 's/password/pwd/g'
 自动启动
在/etc/init.d下创建一个脚本/etc/init.d/bfagent
脚本包含
# chkconfig: 2345 08 92
# description: Automates a packet filtering firewall with ipchains.
chkconfig –add bfagent
 Firewall
vi /etc/sysconfig/SuSEfirewall2, 修改FW_SERVICES_INT_TCP添加需要开放的端口
rcSuSEfirewall2 start stop status   启动停止防火墙
 查看端口的进程号netstat -nlutp|grep 5556
 开机启动自动mount
修改/etc/fstab
添加相应的/dev/sda3            /rtcbuild            ext3   acl,user_xattr        1 1
 查找当前所有目录下的文件是否包含指定字符
grep -rl "saphen" ./
 扩展vmware虚拟机磁盘命令,在vmware目录下找到vmware-vdiskmanager
vmware-vdiskmanager -x 30GB "D:\MyVirtualPC\Windows Server 2003 Enterprise Edition.vmdk"; 扩展以后整个磁盘大小为30GB,原来的文件还在,需要用fdisk命令对磁盘进行创建新分区。
 Vi 文件
:set fileencoding 可以查看文件的编码格式
:set number,输入数字可以转到相应的行
 bzip2 -d **.tar.bz2  解压缩bz2格式文件
 rpm -i iwl-0-03309L.i386.rpm --nodeps  加--nodeps可以忽略依赖的包关系 
 禁止root用户远程ssh登录
修改/etc/ssh/sshd_config文件的PermitRootLogin no
修改ssh端口也在这个文件里Port 999
最后,重启sshd服务  /etc/init.d/sshd restart
 查看文件系统格式  mount –v
 重新mount文件系统为可写  mount -o remount,rw /
 创建大文件,名字为1.txt,102400M相当于100G
dd if=/dev/zero of=./1.txt bs=1M count=102400
 在1内容后面加上输入的文件,输入EOF结束输入
cat << EOF >>1
 察看LINUX是32/64位OS
getconf LONG_BIT
 地址重定向,执行viewlog相当于执行tail后面的命令;执行conf相当于执行cd后面的命令
alias viewlog='tail -f ~/WebServer/logs/cms2a.log';conf='cd VissApp/web-viss/WEB-INF/classes/'

ntp server : 启动NTP服务,NTP服务器设置为本机IP
ntp client : 修改/etc/crontab,增加0-59/1 * * * *   root  /usr/sbin/ntpdate 192.168.231.51
(意思是每1分钟执行ntpdate 192.168.231.51 进行时钟同步)
 export LANG=zh_CN.UTF-8         telnet 软件也设置显示为utf-8
 grub
grub>
我们就可以在这样的字符后面,输入
grub>root (hdX,Y)    -----X表示第一个硬盘的话就等于0,Y表示OS所在根分区,不知道Y的话可以在输入完root(hdX,后按Tab键系统会提示所在分区。
grub>setup (hd0)  -----把GRUB写到硬盘的MBR上
 查看linux内核版本 uname –a
 查看发行版本号 ls /etc/*issue*或者/etc/*release*,然后more一下
 fdisk –l 显示磁盘分区
 fdisk /dev/sdb 为sdb卷分区
 mkfs.ext3 /dev/sdb1  把sdb1磁盘分区格式化为ext3
 grub-install /dev/hd* 重新安装grub到MBR上
 rpm -q mysql可以得到信息mysql-3.23.54a-11
 rpm -qa 列出所有安装过的包
 rpm -ql 包名 无.rpm
 which/whereis mysql 查找RPM包安装在哪
 rpm –e包名,可以包含版本号等信息,但是不可以有后缀.rpm
 rpm -ivh *.rpm 安装rpm包
 getconf WORD_BIT 查看操作系统是多少位
 scp -r vauapp vau234@192.168.21.80:/home/vau234  把本地文件夹vauapp复制到远程机器上
 scp –P 999 -r vauapp vau234@192.168.21.80:/home/vau234  -P是加了端口的
 ls -l |grep "^-"|wc -l 统计文件个数
 find . -amin 1 -exec rm -rf {} \  删除1分钟之前的文件
 ln -s libACE.so.5.4.1 libACE.so.5
 tar -czvf log.tar.gz log
 useradd -d /export/home/ems -m -s /bin/bash -c "ems manager" ems
 useradd -d /export/home/radius -m -s /bin/bash -c "radius server manager" radius
 chmod 777 -Rf [file]
 chown -R smg:users /viss
 source .profile  使profile生效
 find ./ -name "9.2.0" –print
 cat /etc/passwd  获得所有用户信息
 env  获得当前状态信息

 nohup RadiusServer.exe &  后台执行Radius
 tail -f nohup.out          debug log信息
 top 查看系统CPU MEM资源
 gdb ~/j2sdk1.4.2_11/bin/java core.4768 (查看core文件)
 diff 比较两个文件不同之处
 last | more 系统登陆记录
 history 系统操作日志
 du -h (文件总空间)     -a(各个文件大小) -s (文件夹总大小)
 df -h    查看磁盘使用情况
 ldd smg   查看smg使用到的lib信息
 date 设置系统时间
 lsof –p 进程号  list open files

 /etc/pure-ftpb/pure-ftpd.conf,修改AnonymousOnly no; NoAnonymous yes
 /etc/init.d/pure-ftpd start/stop/restart    开启、停止、重新启动ftp服务
 查询某个进程打开文件个数  lsof -p 16285 | wc -l
 ulimit用户进程资源极限 
ulimit –a察看当前用户资源极限
/etc/security/limits.conf
## added by orarun ##
oracle  soft    nproc   2047
oracle  hard    nproc   16384
oracle  soft    nofile  1024
oracle  hard    nofile  65536
sa215    hard   nofile  50000
sa215    soft   nofile  50000
sa215    soft   core    unlimited

网络
 ip route add default via 192.168.4.1 dev eth0 src 192.168.4.5   添加默认路由,通过src出去
 route del -net 192.168.4.0/24 gw 192.168.4.1
 ip route replace default via 192.168.4.1 dev eth0 src 192.168.4.5 替换默认路由
 绑定映射的公网地址到私网
ip addr add 220.248.39.82 dev eth0:0
 实时查看网络流量

 ifconfig -a查看IP地址
 查看HOST IP,cd /etc ,more hosts
 hostid 查看机器ID
 id查看用户ID
 hostname 检查机器名(与机器IP同等)
 putty -telnet 192.168.0.70

 more /etc/sysconfig/network/routes
192.168.50.0 192.168.50.1 255.255.255.0 via dev eth1 vlan-id-00:19:B9:E5:38:54 table 253
default 172.24.252.1 - -

 /etc/init.d/network stop start restart
 telnet
#/etc/init.d/xinetd restart  启动telnet服务
允许root用户使用telnet
#mv /etc/securetty /etc/securetty.bak (可讓root登入telnet)
设置telnet端口
#vi /etc/services
Shell
 用root用户执行,可以在脚本里不输入密码直接运行该用户下的脚本
su - smg2111 -c "cd /home/smg2111/smgapp;./watchdog_smg2111.pl stop"
 `date +%A-%T`   输出日期
 date +%s
 不删除文件而是直接清空文
#!/bin/bash
cd /var/log
for i in *
do
cat /dev/null > $i
done
HA
 /opt/ha/bin/hasvcadm -m estone –l  (-l切换,-t 启动,-p 停止,-m服务名)
 /opt/ha/bin/hastat –a 查看状态
Oracle

 启动oracle报错:没有权限解决
1、可以用如下命令启动sqlplus /nolog;     SQL> conn  system/system@viss as sysdba;
2、增加一个dba组并赋予oracle用户,在oracle用户下输入groups可以看到有dba这个组
 Union合并两个select语句的查询结果,前提是查询结果的返回字段需要一致
(select EMS_VS.NAME AS 视频服务器,EMS_CAMERA.NAME AS 摄像头
FROM EMS_CAMERA,EMS_VS WHERE EMS_CAMERA.VS_ID = EMS_VS.ID )
union
(select EMS_VS.NAME AS 视频服务器,'' FROM EMS_VS WHERE EMS_VS.ID NOT IN (SELECT EMS_CAMERA.VS_ID FROM EMS_CAMERA))
;

select count(*) from v$process
select count(*) from v$session
select * from v$open_cursor
select sql_text,count(*) from v$sql s , v$session se where se.prev_hash_value =s.hash_value group by sql_text
 Select * from tab 查询所有表结构
 select * from ems_area where  name like 'Area%' order by id desc; 查询某个表里的名字为以Area开头的所有记录,并以降序排序
(%表示通配所有字符,_表示通配一个字符,order by后默认不填是升序ASC,DESC是降序)
 Alter table ems_area disable all triggers; 暂停某个表所有的triggers
 Alter trigger TRG_AREA_DEL enable; 启用某个trigger
 递归列出查询结果
select ems_area.id, sys_connect_by_path(ems_area.name,'|') from ems_area start with ems_area.parent_id='<ROOT>' connect by prior ems_area.id=ems_area.parent_id;
 插入select出来的数据到一个表里
insert into biao (select * from ems);

 同时查询不同表的记录
select viss170.test.*, viss215.ems_vs.name, viss215.ems_vs.ip, viss215.ems_camera.name from viss170.test, viss215.ems_vs, viss215.ems_camera where viss170.test.id=viss215.ems_camera.area_id and viss215.ems_vs.id= viss215.ems_camera.vs_id;

 删除用户session
select username,sid,serial#,STATUS from v$session where username = 'VISS1';
alter system kill session '62,53053';  ( 62是sid,53053是serial# )
 dbca  在Xmanage上弹出设置数据库SID窗口
 alter user sys indentified by password; 修改数据库用户密码

 安装数据库权限问题:chown -R -h oracle:dba /opt/oracle  为oracle给予该目录的权限

 ORA-28547:连接服务器失败
R:要注释掉listener.ora中的(PROGRAM = extproc)

 #sqlplus viss/bell1234@ems
SQL> select count(*) from ems_performance_data;
如果数据太多, 则用
SQL>truncate table ems_performance_data;
SQL>commit;
delete from plr_info;
来删除里面的数据
SELECT COUNT(*)  FROM PLR_INFO WHERE passway_id = '12338'
select count(*) from plr_info  plr where plr.IMAGE1_PATH like '%/200803/11/10/%';
DELETE FROM PLR_INFO WHERE passway_id = '12338'

另外, 再看一看告警表ems_alarm, 估计里面也有很多数据.

 imp cms212/cms212@viss file=./cms212-091113.dmp full=y;  导入备份文件,VISS215是原数据表用户名,导入时不要创建tables,只需要创建用户和表空间。
exp cms212/cms212 owner=cms212 file=./cms212.dmp导出 (owner是表空间的用户名)

只导出某个表数据可以使 用exp user/passwd@sid ,然后一步步选择。

exp viss212/viss212@mydb tables=ems_vs,ems_alarm file=/opt/oracle/data.dmp (选择某个表导出,用逗号分开)

创建数据库表空间以及用户 
$sqlplus system/bell1234@orcl
CREATE TABLESPACE cms212  DATAFILE '/home/oracle/oracle/product/10.2.0/db_2/oradata/viss/cms212.dbf' SIZE 1024M AUTOEXTEND ON NEXT  50M MAXSIZE UNLIMITED;
create user cms212 identified by "cms212" default tablespace cms212;
GRANT CONNECT,RESOURCE TO cms212;
GRANT CREATE VIEW TO  cms212;
grant dba to cms212; 赋予DBA权限给cms212


SQL> revoke unlimited tablespace from sap;  //否则将不能导入数据到viss212的空间!
SQL> alter user sap quota 0 on cms212;
SQL> alter user sap quota unlimited on viss215;
SQL> commit;
SQL> exit

 启动oracle数据库
bash-2.05$ dbstart
bash-2.05$ sqlplus /nolog
SQL> connect / as sysdba
SQL> startup
bash-2.05$lsnrctl start

 tnsping emsdb
 默认数据为中文insert到数据库之前必须保证oracle用户的环境变量为:
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
否则显示乱码
 更改数据库语言
SQL> select userenv('language') from dual;
lsnrctl stop;
STARTUP MOUNT;
ALTER SYSTEM ENABLE RESTRICTED SESSION;
ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0;
ALTER SYSTEM SET AQ_TM_PROCESSES=0;
ALTER DATABASE OPEN;
ALTER DATABASE CHARACTER SET INTERNAL_USE AL32UTF8;
SHUTDOWN IMMEDIATE;
STARTUP;

英文XP操作系统打开TOAD显示乱码解决办法:
加入环境变量NLS_LANG = SIMPLIFIED CHINESE_CHINA.ZHS16GBK,重新启动TOAD

 远程数据库连接
sqlplus username/password@IP:port/sid
sqlplus viss220/viss220@172.24.252.57:1521/emsdb

 查看ORACLE版本
select banner from sys.v_$version;

 察看数据库名
select name from v$database;
察看数据库服务名
show parameter service_name;
察看数据库域名
show parameter domain;

 修改SID和ORACLE路径
/etc/profile.d/oracle.sh

 select count(*),reduceframe_status from ems_storage_file group by reduceframe_status
  COUNT(*) REDUCEFRAME_STATUS
---------- ------------------
      7013                  0
     27325                100
        15                101
         5                300
4 rows selected
 insert into语句
使用system用户把sa212表相关数据导入到cms212表(大数据量时使用/*+ append */可以加快数据插入速度)
insert /*+ append */ into cms212.ems_storage_task(ID,RECORD_LEVEL,TIMES) select ID,RECORD_LEVEL,0 from sa212.ems_storage_task;
 alter语法
alter table EMS_STORAGE_FILE disable constraint EMS_STORAGE_FILE_U01;
 drop语法
drop TRIGGER TRG_STORAGE_FILE_INS;
 update语法
update EMS_ORGANIZATION set STORAGE_QUOTA_USED = (select NVL(sum(file_size),0) from ems_storage_file where ORGANIZATION_ID = EMS_ORGANIZATION.id);

update EMS_STORAGE_TASK set FILE_COUNT = (select NVL(count(*),0) from ems_storage_file where task_id = EMS_STORAGE_TASK.id);

 $ORACLE_HOME/network/log/listener.log过大导致数据库侦听出问题,解决办法是清空listener.log
bash-2.05$ :> listener.log
bash-2.05$ lsnrctl stop
bash-2.05$ lsnrctl start
 SQL>alter system set log_archive_start=true scope=spfile; 然后重新启动数据库
SQL>show parameter log_archive_start;  察看log_archive_start是否为TURE
 ORACLE日志位置
$ORACLE_HOME/admin/SID/bdump/ alert_SID.log
$ORACLE_HOME/network/log/listener.log ($lsnrctl set log_status off/on)
Sun
网络
 telnet 反应很慢
删除 /etc/nsswitch.conf里面的host:files dns nis中dns
 sun server 开机进入console口,输入boot,然后修改IP地址:ifconfig bge0 ** netmask **
 ifconfig bge0 addif(removeif) 172.24.252.44
 创建/etc/hostname.le0:n文件,/etc/hostname.bge0:1 内容为myhost2
 ifconfig bge0:1 down/up
 Oracle数据库备份导出命令:exp system/system owner=viss215 file=/export/home/oracle/cms215.dmp (owner是表空间名称)
 prstat 查看进程占用CPU资源
 uname –a 查看OS版本
 dmesg |grep CPU | grep MEM  查看服务器硬件资源
 dmesg |grep "Physical Processor ID"  查看服务器CPU个数
 dmesg |grep "Processor Core ID"  查看服务器CPU核心个数
 route add 192.168.240.0 192.168.250.1
网关--修改 /etc/defaultrouter 
掩码—修改 /etc/netmasks
查看路由   netstat –r


Windows
 网口获取不到IP地址:
    ipconfig /release
ipconfig /renew
netsh winsock reset
重启PC

• 查询端口是否被占用
netstat -aon|findstr "8080"
• 通过进程号查询进程名字
tasklist|findstr "2448"
• 根据进程名杀进程
taskkill /f /im chrome.exe

TOMCAT
 httpd支持软连接,加上FollowSymLinks
<Directory /var/www/html/pub>
Options Indexes FollowSymLinks
</Directory>

 修改tomcat启动使用内存
Windows环境请修改“catalina.bat”文件,Linux环境请修改“catalina.sh”文件。在文件中设置下面的语句:set CATALINA_OPTS= -Xms256m -Xmx512m 其中,-Xms 设置最小使用内存,-Xmx 设置最大使用内存


MySQL
 导入指定字段
INSERT INTO 目标表 (字段1, 字段2, ...) SELECT  字段1, 字段2, ...  FROM 来源表;
 Mysql数据表字段datetime和date类型的区别是前者2010-07-25 00:20:10 ,后者只有2010-07-25
 执行创建数据库脚本
Mysql>\. createDB.plb    前面要加\. ,后面不要加;
 Select id , name,sal from emp limit ?,?   mysql分页查询,第一个?表示从第几条记录开始(从0开始),第二个?表示取多少条记录
 修改用户密码
>update user set password=password("12345678") where user="saphen";
>flush privileges;
 修改字符集
mysql> show variables like 'character_set_%';
mysql> set character_set_client=utf8;
mysql> set character_set_connection=utf8;
mysql> set character_set_database=utf8;
 修改表字段的属性
alter table onlineuser modify LOGIN_TIME varchar(21);
 删除主键
alter table t_acct drop primary key;
 删除名字为ACCTNO的唯一键
alter table t_user drop index ACCTNO;
 删除名字为t_acct_fk的外键
alter table t_acct drop foreign key t_acct_fk;
 修改表字段ID为自动增加
alter table book modify column Title_ID int auto_increment;
 修改user表字段USERNAME的属性为unique
alter table user add unique(USERNAME);
 创建一个表
create table test.onlineuser(
ID varchar(32) PRIMARY KEY not null,
USERNAME varchar(32),
SESSION_ID varchar(32),
LOGIN_TIME date)
 登录:mysql -u root -proot   <用户名为root,密码也为root>
 查询数据库:show databases;
 使用数据库:use mysql    <使用名字为mysql的数据库>
 查询数据库的表:show tables
 当前选择了哪个数据库: SELECT DATABASE();
 查看表结构: desc people <people为表名>
 创建用户并赋予权限:grant select,update,insert,delete on *.* to test@localhost identified by "test";    <创建用户名为test,密码为test>
 拥有最大的权限:GRANT ALL PRIVILEGES ON *.* TO test@localhost WITH GRANT OPTION;
 修改root用户密码:  mysqladmin -h localhost -u root -p password bell   <bell为root用户的新密码,需要输入root用户的老密码>
 使外面的机器也能访问mysql: GRANT ALL PRIVILEGES ON *.* TO 'username'@'%' IDENTIFIED BY 'password';  设置后需要重新启动mysql,windows的mysql需要kill掉进程。
 SQL文件的导入和导出
导出:
mysqldump --opt database > backup-file.sql
导入:
mysqladmin create target_db_name  (先创建空库)
mysql -u root -p target_db_name < backup-file.sql
 DMP文件导入导出:
导出:
mysqldump -u viss2114 -pviss2114 -h 127.0.0.1 -r /home/cms2114/QQQQ2008082110021.dmp viss
导入:
mysql -u root -p -B -h 127.0.0.1 viss < QQQQ2008082110021.dmp
• Mysql忘记root密码
1. 修改my.cnf,在[mysqld]的段最后加上一句:skip-grant-tables
2. 重启mysql;
3. # /usr/bin/mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3 to server version: 3.23.56
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.
mysql> USE mysql ;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> UPDATE user SET Password = password ( ‘new-password’ ) WHERE User = ‘root’;
Query OK, 0 rows affected (0.00 sec)
Rows matched: 2 Changed: 0 Warnings: 0
mysql> flush privileges ;
Query OK, 0 rows affected (0.01 sec)
mysql> quit


Windows
 查询文件并删除
del /f /s /q *.xml
 网口获取不到IP地址:
ipconfig /release
ipconfig /renew
netsh winsock reset
重启PC
 FAT32分区格式的磁盘分区转换成NTFS分区  convert C:/FS:NTFS
输入命令后出现了命令行窗口,提示输入卷标,输入磁盘原卷标后询问是否转换,输入Y,确认后,所有的转换将在系统重新启动后完成
 nbtstat -A 10.30.12.104    通过IP地址查询到主机名和MAC地址
 arp –a     先ping对方的IP地址,然后使用这个命令查找对方的MAC地址
 tracert 10.30.12.104   查询对方路由
 net view    查看同一个局域网的所有主机名

磁盘阵列
 rcopen-iscsi start  启动iscsi服务
 iscsiadm –m discovery –t st –p IP  查找相关IP的node
 iscsiadm –m node 列出所有的node
 iscsiadm –m node –r ID –l  登录ID
 iscsiadm –m node –r ID –u  退出登录ID
 fdisk –l  查看磁盘分区
 fdisk /dev/sdc  为磁盘分区
 mkfs.ext3 /dev/sdd1  使用ext3格式化分区
 mount /dev/sdd1 /home/sa/file0 
 umount –l /dev/sdd1  强制umount
 ll /dev/disk/by-path  查看dg相应的分区

SA服务器使用的操作系统是SUSE10,因此需要安装open-iscsi.rpm的包,安装完成后依次使用以下命令查找磁盘阵列的ID号并登录上去。

启动rcopen-iscsi start
查找目标 iscsiadm -m discovery -t st -p IP
找到后    iscsiadm -m node查看到IP对应的id
CPU2-171:~ # iscsiadm -m node
[f6e826] 192.168.0.121:3260,1 iqn.1986-03.com.hp:storage.msa2012i.0803d51e34.b
[832943] 192.168.1.3:3260,2 iqn.1986-03.com.hp:storage.msa2012i.0803d51e34.b
[f35632] 192.168.0.33:3260,1 iqn.2004-11.tysoft.target.ipsan1:0
[205dbe] 10.0.3.56:3260,1 iqn.2004-11.tysoft.target.ipsan1:0
然后使用 iscsiadm -m node -r ID -l登陆  (Id为f6e826)
退出登陆使用iscsiadm -m node -r ID -u
fdisk –l 查看磁盘分区
为磁盘卷分区
CPU2-171:~ # fdisk /dev/sdc
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.


The number of cylinders for this disk is set to 127647.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-127647, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (1-127647, default 127647):
Using default value 127647

Command (m for help): wq
The partition table has been altered!

Calling ioctl() to re-read partition table.

Reboot OS
为磁盘分区格式化为EXT3
mkfs.ext3 /dev/sdd1   (格式化过程中PC机不能断开)

使用磁盘阵列
所有分区都格式化完毕后,使用mount命令把空间移植给使用的文件夹
mount /dev/sdb1 /home/file0
mount /dev/sdc1 /home/file0
mount /dev/sdd1 /home/file0
mount /dev/sde1 /home/file0
mount /dev/sdf1 /home/file0

CPU2-171:/home/file0 # df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda2              64G   11G   54G  17% /
udev                 1014M  156K 1014M   1% /dev
/dev/sdb1             1.6T  129M  1.5T   1% /home/file0
/dev/sdc1             1.6T  129M  1.5T   1% /home/file0
/dev/sdd1             1.6T  129M  1.5T   1% /home/file0
/dev/sde1             1.6T  129M  1.5T   1% /home/file0
/dev/sdf1             1.6T  129M  1.5T   1% /home/file0

Juniper netscreen 防火墙
 获取配置信息
get config  
 抓取指定源地址到指定目的地址的UDP包(ip-proto=17时为UDP)
Set ffilter src-ip x.x.x.x dst-ip x.x.x.x dst-port xx ip-proto 17  
 抓取指定目的地址的UDP包
Set ffilter dst-ip  211.136.86.139 ip-proto 17
 打开debug
debug flow basic
 查看包信息
get dbuf stream
 清除包信息
clear dbuf
 关闭debug设置
undebug all
JAVA编程
遍历list的方法
List<FileItem> list = new List<FileItem>();
1、 for(FileItem item:list){
item = (FileItem)list.next();
}
2、 for(int i=0;i<list.size();i++){
FileItem item = (FileItem)list.get(i);
}
3、 Iterator it = list.iterator();
while(it.hasNext()){
FileItem item = (FileItem)it.next();
}

FTP Server(Pure-ftpd)
** 目录结构:
/etc/pure-ftpd   
(pure-ftpd.conf  pureftpd.passwd  pureftpd.pdb)
/usr/sbin/
(pure-ftpd    pure-ftpwho)
/usr/bin/
(pure-pw           pure-pwconvert    pure-statsdecode)

** 配置“pure-ftpd.conf”
AnonymousOnly               no
NoAnonymous                 no

** Pure-ftpd使用初始流程:
首先创建/ftphome,赋予ftp用户和组权限;pure-ftpd是通过linux用户权限来做虚拟用户权限限制的。
1)先创建属于ftp组(id=49)的用户,然后获得该用户的id,以下是1000
useradd -d /home/test1 -m test1 -g ftp -s /bin/bash -c "ftpuser account"
2)创建pure-ftp的虚拟用户sap,使其挂载在实际用户(ftpuser)下,并指定ftp目录/ftphome给它,并保存密码到pureftpd.passwd里
/usr/bin/pure-pw useradd s -u ftpuser -g ftp -d /ftphome -f /etc/pure-ftpd/pureftpd.passwd -m
3)启动pure-ftpd
/usr/sbin/pure-ftpd -l puredb:/etc/pure-ftpd/pureftpd.pdb -E -B -O clf:/var/log/pure-ftpd.log
4)传输中文名称的文件报错(Failed to convert command to 8 bit charset):
需要设置ftp client(FileZilla)的charset为“force UTF-8”就可以了,putty终端显示中文名称的文件为乱码需要更改putty的translation为UTF-8

** 日常维护命令:
pure-pw list 列出当前用户以及所在目录
pure-pw show test 显示test用户的属性信息
pure-pw passwd test -m  修改test用户的密码 (-m表示使修改同步到pdb文件)
pure-pw userdel test -m 删除用户test
/usr/sbin/pure-ftpwho 查看当前已连接的用户
/usr/bin/pure-pw usermod test -u ftp -g ftp -d /ftphome -f /etc/pure-ftpd/pureftpd.passwd -m  修改test用户的属性

SVN Commands
Subversion Commands:
Subversion command summary cheat sheet:
Command Description
svn --help List Subversion commands
svn help command
Also: ? or h Help on given "command"
svn add filename
svn add directory Add a file or directory to Subversion CM control.
Must also perform: svn ci filename (or svn commit) to upload the file or directory. File will not be available in the repository until a "commit" is performed. If adding a directory, the directory and all of its contents recursively are added. i.e.:
svn ci directory
svn commit directory
svn commit .
svn blame filename
svn blame -r RevisionNumber filename
Also: praise, annotate, ann Show file contents with revisions annotated with author information.
svn cat filename List contents of file under Subversion control.
svn checkout http://node-name/repos/svn/trunk/parentPath/path
This creates:
path/file1
path/file2
...
svn checkout http://node-name/repos/svn/trunk/parentPath .
This creates:
path/file1
path/file2
...
Note the difference a "." makes.
svn checkout file:///repos/svn/trunk/path/
svn co -r 497 http://node-name/repos/svn/trunk/path file-name
Also: svn co https://..., svn://..., and svn+ssh://
MS/Windows: svn co file:///c:/repository/project/trunk Checkout every file from the path and subdirectories specified below. Creates "working" copy of files and directories.
Checkout a repository.
Use option "-r" to specify a specific revision other than the latest.
The URL "svn://" communicates with an SVN server (port 3690)
The URL "http://" comunicates with the Apache server and module mod_dav_svn (port 80) [more common server]
svn cleanup Cleanup subversion files resulting from escaped processes and crashed.
svn commit filename
svn commit --message "Message goes here." filename
svn commit -m "Message goes here." filename
svn ci filename1 filename2 filename3
svn ci . Check-in (commit) local "working" file, files or directory and contents (recursively) into Subversion repository. Atomic, i.e. all committed or none, no incomplete check-in.
svn copy source destination_clone
Also: svn cp ... Copy file or directory tree. One can copy from one local working copy to another or to repository server URL's. The sources and destinations can be working copies or URLs.
svn copy http://host/repos/project/trunk http://host/repos/project/tags/TagName-1.4.5 -m "Tag Release 1.4.5" Tag a release. Takes a snapshot of the repository and assigns a name. This can be performed at any directory branch.
svn copy . http://host/repos/project/tags/TagName-1.4.5 -m "Tag Release 1.4.5" Tag a release. Takes a snapshot of your local working copy and assigns a name. This can be performed at any directory branch.
svn delete filename
svn delete directory
Also: del, remove or rm
svn rm http://host/repos/project/trunk/file-or-directory Delete file from repository. The UNIX command rm file-name. Must perform a "commit" to update the repository and local working directory with the changes. i.e.:
svn commit .
svn diff filename
svn di filename Show file diffs between SVN repository and your file changes using GNU file diff format. Use GUI diff tools as shown below.
svn diff -r rev1:rev2 filename Show file diffs between specified versions.
Example: svn diff -r 456:459 subfn.cpp
Using GUI diff tool: svn diff -r 457:459 --diff-cmd kdiff3 file-name
svn diff filename > patch-file Generate patch file used by the patch command.

svn export directory Export directory tree to your file system but it will not be a "working directory" under SVN control.
svn export -r Rev-Number http://node-name/path Export directory tree of specified version and create local directory tree and files not under SVN control.
svn import local-directory http://node/repos/svn/trunk/directory Add directory (and files in it recursively) to path in repository specified.
svn info filename Display information about file or directory. (Date modified, author, revision, path in repository.)
Can not specify a URL.
svn list directory
svn list file-name List file or directory of files in repository. Used to browse repository before checkout. If current directory is given (svn list ./), then Subversion will list the repository URL of the current directory.
svn list -r RevisionNumber directory List directory of files in repository in specified revision.
svn lock filename -m "comment as to why its locked or by whom"

(Comment is not required but is often useful) Lock file to grant exclusive access to one and forbid all others. A commit will unlock the file (unless the "--no-unlock" option is used). A lock can be removed with the commands: svn unlock filename, svnlook and the svnadmin comands (i.e. List: svnadmin lslocks and remove: svnadmin rmlocks filename).
svn log filename
svn log .
svn log http://URL/path/file
svn log -v .
svn log -r RevisionNumber http://URL/path/file Show the Subversion log messages for a set of revision(s) and/or file(s) and/or all directory contents in repository.
List verbose. Includes list of all files in change
Shows the file changes associated with revision number.
svn merge http://url/path/branch1@revX http://url/path/branch2@revY working-local-dir
svn merge file1@revJ file2@revK
svn merge -r 414:411 http://url/path working-dir
svn merge -r 413:HEAD file-name Merge directory changes into your current working directory or merge a file in Subversion into the file in your working directory. If target is not specified, the identical basename or current directory is assumed. Used to incorporate changes checked in which are not accounted for in your file or to merge branches.
Example using GUI merge tool:
svn diff -r 459:454 --diff-cmd kdiff3 --extensions '-m' file-name
Next, tell subversion that the conflicts have been resolved:
svn resolve file-name
Finally, check-in file: svn ci file-name
or abort changes: svn revert file-name
svn merge --dry-run -r 414:413 http://url/path Test merge. No changes are made to your local working copy but shows Subversion feedback as if merge was performed.
svn merge -r 414:413 http://url/path
svn merge -r 414:413 . Undo changes committed in revision 414.
svn mkdir directory
svn mkdir http://URL/directory Create a new directory under version control.
svn move directory1 directory2
svn mv directory1 directory2
svn mv file-old-name file-new-name Rename or move a file or directory. Moves/renames file/directory in repository and in local work area.
Must perform svn ci file-new-name after the move for changes to to take place in repository.
svn revert filename Undo changes in local work files. Throw away local changes.
svn resolved filename Run this command after resolving merge conflicts. Next "commit" your changes.
svn status
svn status -u
svn status -u .
svn status -uq . Show status of file changes in current directory and recursively in directories below.
Show out of date file info: svn status --show-updates
(equivalent: svn status -u)
-u: Determines status by comparing your local repository with the server repository. Without this option, the status shown will only be the changes you have made in your local repository.
-q: Quiet. Do not print "?: File/directory not under version control" or "!: File/directory missing" extraneous information.
First collumn:
• U: File to be updated
• A: File to be added
• D: File to be deleted
• R: File to be replaced
• G: File to be merged
• C: Conflicting changes
• X: Resource is external to repository (svn:externals)
• ?: File/directory not under version control
• !: File/directory missing
Second collumn: Modification of properties
• ' ' no modifications
• 'C' Conflicted
• 'M' Modified
• '*' Local file different than repository. File will be overwritten with the updated version from the server, if you perform an update.
Third collumn:
• ' ' not locked
• 'L' locked
• 'S' switched to a branch
svn switch http://server/new-branch
svn switch --relocate http://server/old-path http://server/new-path Switch your local working copy to mirror a new repository branch instead of main trunk or previous branch. Also allows you to point your repository to a new path on the server if the server path changes since you performed a check-out.
svn update
svn update filename
svn update -r458 filename
svn update --ignore-externals ./ Migrate all updates from Subversion repository to your local copy (recusively for all files in the current directory and all below it). If there have been updates to the svn repository since you downloaded the files, subversion will give you the opportunity to merge. Status of files will use the coding as stated above for "status". Files marked with a "C" (conflict) should be merged of reverted. If merged then one can perform a "resolve" and then a "check-in".
If a file name is specified, only that file is updated.
Can also syncronize to a specified revision given by -r.
Use --ignore-externals to avoid the slow processing of externals to a potentially slow distant internet server.
Where RevisionNumber is:
• HEAD: The latest revision in the repository.
• BASE: The "pristine" revision of an item in a working copy. Matches checked out version before any modifications.
• COMMITTED: The last revision in which an item changed before (or at) BASE.
• PREV: The revision just before the last revision in which an item changed. (Technically, COMMITTED - 1.)
________________________________________
Example Session:
(Assumes that the repository has already been created. For Subversion repository creation and Subversion server configuration, see the (YoLinux Subversion and Trac tutorial)
• Checkout: svn checkout http://svnserver/repos/svn/trunk/Project1
• Go to source code directory: cd Project1/src
• Edit files:
o vi file1.cpp
o vi file2.cpp
• Verify and test: make
We are ready to check-in the files into the Subversion repository.
• Check repository and report on new revisions and changes others have checked in: svn status -u .
• After many long hours or days of editing and work, get updates others have made: svn update
    U file.h
    C file1.cpp
    G file2.cpp
    ? a.out
You will see:
o U: File was updated with a newer version checked-in since your checkout.
o G: Automatically merged with no conflicts.
o C: Not merged due to conflicts. You made changes to the same section of code as the update made by someone else since your checkout.
• For each "conflicted" file there will be three new local files generated by "update":
o file1.cpp.mine (File - post editing)
o file1.cpp.rold (BASE - pre editing)
o file1.cpp.rnew (HEAD - Updated file from repository)
The file file1.cpp still exists but with svn conflict marker strings added in the file.
At this point, a check-in will fail until the merge is resolved.
• Merge options:
o Edit the file file1.cpp
Text markers are placed in the file to show the conflicts between the "HEAD" and "mine" versions.
OR
o tkdiff -conflict file1.cpp
OR
o Use a GUI merge tool: kdiff3 file1.cpp.mine file1.cpp.rnew -o file1.cpp
OR
o Throw out your changes/abort: svn revert file1.cpp
No resolve or check-in necessary if file is reverted.
• Verify and test, again: make
• Notify Subversion that conflicts have been resolved: svn resolved file1.cpp
Note: This also removes the temporary files ".mine" and ".r###".
• Check-in to Subversion repository: svn ci -m "Add comments here" file1.cpp
________________________________________
Subversion Properties:
Files under revision control can include Subversion keywords which properties can be set with the "propset" command. Keywords are substituted with the Subversion properties and will not appear in the file until a commit is performed. Other properties are used to modify the behavior of Subversion.
The following properties can be set on entities stored in Subversion:
Property Description
svn:ignore A newline separated list of file patterns to ignore. List of files/directories to be ignored by svn status
svn:keywords Valid RCS style keywords are:
• HeadURL - The URL for the head version of the object.
Also: $URL$
• LastChangedBy - The last person to modify the file.
Also: $Author$
• LastChangedDate - The date/time the object was last modified.
Will appear as: $LastChangedDate: 2005-07-22 22:02:37 -0700 (Fri, 22 Jul 2005) $
Also: $Date$
• LastChangedRevision - Describes the last known revision.
Will appear as: $LastChangedRevision: XXX $ where "XXX" is the revision number.
Also: $Rev$, Revision
• $Id$ - A compressed summary of the previous 4 keywords.
Example RCS style comment Example Output
/* $URL$
   $Rev$
   $Author$
   $Date$
   $Id$
*/
                     /* $URL:http://server/svn/path/file.cpp $
   $ Rev:2 $
   $ Author:Greg $
   $ Date:2006-10-12 14:31:84 -0400 (Thu,12 Oct 2006)$
   $ Id:file.cpp 3 2006-10-12 18:31:84Z Greg $
*/
                    

svn:executable Ensure file attribute is executable. Possible values: ON, OFF
Example: svn propset svn:executable ON app.exe
svn:eol-style One of 'native', 'LF', 'CR', 'CRLF'. Specify and maintain specified line ending for text file.
• LF: Unix, Linux, standards based OS, proprietary legacy systems, etc.
• CRLF: DOS and Microsoft OSs
• CR: Response input scripts, etc
Example: find ./ -name "*.h" -exec svn propset svn:eol-style LF {} \;
svn:mime-type The mime type of the file:
• text/html
• text/css
• text/plain
• image/jpeg
• ...
See file /etc/mime.types for a list of mime types.
Examples:
• svn propset svn:mime-type text/plain file.cpp
• svn propset svn:mime-type text/html file.html
Web pages rendered from subversion will display as HTML source rather than as a web page unless this mime type is applied.
svn:needs-lock Prevents conflicts for files which can not be contextually merged. i.e. photos, binaries, object libraries.
svn:externals List of files or directories pointed to. Locate repository where directory specified should be retrieved. The directive propset is not required:
svn propedit svn:externals local-target-dir
local-target-dir http://server/svn/dir-remote
local-target-dir/subdir -r### http://server/svn/dir-remote2
svn update
svn commit
svn propget svn:externals ./
The property applies to the directory. Subversion can not list or web browse svn:externals. Check-out ("co"), "export" and "log" can be performed.
Must set environment variable "EDITOR", "SVN_EDITOR", "VISUAL" or set the Subversion configuration file (~/.subversion/config) attribute editor-cmd. i.e.: export EDITOR=vi
[Potential Pitfall]: Apply svn externals to directories and not files. (version 1.4)
[Potential Pitfall]: If generating a tag (branch), one should assign the revision number to the external link to truly snapshot the repository for that tag. This revision number should be specified in the tagged branch version of the svn external.
[Potential Pitfall]: The revision numbers shown by svn info will reflect the version numbers of the repository in which the files are stored. If the files are imported via an svn external directory, the revision numbers will reflect that of the external repository which the external points to and thus from where the files were imported.
Command Description
svn propdel PropertyName file-name
svn propdel --revprop -r RevisionName http://url/path
Also: pdel, pd Remove property name from files or directories.
Remove properties on file in repository.
svn propedit PropertyName file-name
svn propedit --revprop -r RevisionName http://url/path
Also: pedit, pe Edit property name of files or directories.
Edit properties on file in repository.
svn propget PropertyName file-name
svn propget --revprop -r RevisionName http://url/path
Also: pget, pg Print value of property name of files or directories.
Print properties on file in repository.
svn proplist file-name
svn proplist *
svn proplist --revprop -r RevisionName http://url/path
Also: plist, pl List properties of file, files or directory.
svn propset PROPNAME PropertyValue file-name
svn propset PROPNAME --revprop -r RevisionName PropertyValue http://url/path
svn propset svn:mime-type text/html file-name.dat
Also: pset, ps Set properties of file or directory.
Set mime type for a file in the repository. Must perform a commit to upload changes to the repository.
Set file properties so that "^M"'s are removed upon check-in:
svn propset svn:eol-style LF file-name.txt
See YoLinux Subversion server configuration tutorial: No ctrl-M.

________________________________________
Subversion and Graphical diffs for Linux:
Three types of file differences are covered in this section:
1. Show file differences made since checkout was made. This shows the changes you have made. It is usefull to perform this before an update.
2. Show file differences between two files versions stored in Subversion.
3. Show differences / conflicts, choose and merge. Use our bash script svndiffwrapper which integrates into Subversion's file check-in process.
________________________________________
1) File differences since checkout:
The following scripts will allow you to view the changes you have made since checkout. Use the script before running "svn update" as an update will alter the file with diff chevron (>>>>) markers. After performing a "svn update", use tkdiff, gtkdiff or kdiff3 as described below instead of the scripts:
Use the following bash shell script to use the graphical diff tool "mgdiff" with Subversion.
svndiff:
#!/bin/bash
# svndiff 1.0
# usage: svndiff file

if [[ ! -d .svn ]]
then
   echo ERROR: You are not working in an SVN directory.
   exit 1
fi

rev="--revision HEAD"

if [[ ! -n $1 ]]
then
   echo "Usage: svndiff [option] file"
   echo "Options:"
   echo "  -h         Diff with latest in repository (HEAD) - Default"
   echo "  -b         Diff with what you had checked out (BASE)"
   echo "  -c         Diff with COMMITTED, the version before BASE"
   echo "  -p         Diff with PREV, the version before COMMITTED"
   echo "  -r revnum  Diff with specified revision (specify integer)"
   exit 1
fi

while getopts ":r:hbcp" Option
do
   case $Option in
     h) rev="--revision HEAD";;
     b) rev="--revision BASE";;
     c) rev="--revision COMMITTED";;
     p) rev="--revision PREV";;
     r) rev="--revision $OPTARG";;
     *) echo "Incorrect option specified. Use -h or -b or -r #";;
    esac
done
shift $(($OPTIND -1))

# Define graphical diff tool
#

# The geometry option used by Motif, Tcl and X based programs
geometry="-geometry 1280x800+0+0"

# The following is for Motif diff
# -w: ignore white space
dif="mgdiff -args -w"

file=$1
prev=${file}_PREV

# Trap bash command signals
# SIGINT   2
# SIGQUIT  3
# SIGTERM 15
trap "rm -f $prev" 2 3 15
svn cat $rev $file > $prev 2>/dev/null
$dif $geometry $prev $file

sleep 1
rm -f $prev
               
Compares your current local copy with the latest in the repository (Default "-h").
OR
Use the following bash shell script to use the graphical diff tool "gvimdiff:" with Subversion:
svndiff:
#!/bin/bash
# usage: svndiff file

if [[ ! -d .svn ]]
then
   echo ERROR: You are not working in an SVN directory.
   exit 1
fi

# Define graphical diff tool
#

dif="gvimdiff \"+colo morning\" -R"

file=$1
prev=PREV_${file}

# Trap bash command signals
# SIGINT   2
# SIGQUIT  3
# SIGTERM 15
trap "rm -f $prev" 2 3 15
svn cat $file > $prev 2>/dev/null
$dif $prev $file

# Sleep for non-blocking apps like gvimdiff.
# Allow gvimdiff to read file before it is deleted.
sleep 2
rm -f $prev
               
Compare your current local copy with the original copy you checked out.
________________________________________
2) File differences between two revisions:
This configuration supports the use of GUI diff tools with Subversion by using the command: svn diff -r 457:459 --diff-cmd
Some diff tools are supported with native svn. i.e.: svn diff -r 457:459 --diff-cmd kdiff3 file-name while others require a wrapper script to arrange the arguments correctly.
Subversion configurations and defaults are specified in the file: $HOME/.subversion/config
..
...

[helpers]
editor-cmd = gedit
diff-cmd = /opt/bin/diffScript
diff3-cmd = /opt/bin/diff3Script

...
..
               
This configuration configures Subversion to execute the script /opt/bin/diffScript to launch your own diff toolwith the command: svn diff -r Old:New URL.
File: /opt/bin/diffScript
#!/bin/bash

LeftLabel=$3
RightLabel=$5
LeftFile=$6
RightFile=$7

#gtkdiff $LeftFile $RightFile
tkdiff $LeftFile $RightFile -L "$LeftLabel" -L "$RightLabel" &

# wait for command to finish
wait
               
Note: To debug what is passed as a command line argument to the diff tool, set the diff-cmd to "echo":
..
...

[helpers]
diff-cmd = echo

...
..
               
This configuration echos to the screen the command line arguments being passed to the diff tool when the following command is executed: svn diff .....
i.e. -u -L d0/f01.cpp (revision 1) -L d0/f01.cpp (working copy) d0/.svn/text-base/f01.cpp.svn-base d0/.svn/empty-file
________________________________________
3) Conflicts, file differences and merge:
• tkdiff: Subversion conflict resolution merge: tkdiff -conflict file1.cpp
Select from tkdiff toolbar: "Merge" + "Show Merge Window" to open third results window.
• kdiff3 diff and merge: svn diff -r 457:459 --diff-cmd kdiff3 --extensions '-m' file-name
• svndiffwrapper: Bash script to add options to Merge|Ignore|Accept|Revert etc as a result of a check-in. This script does it all!!
Edit file: $HOME/.subversion/config
...

[helpers]
diff-cmd = svndiffwrapper
diff3-cmd = svndiffwrapper

...
                   
Use our bash script svndiffwrapper to perform this integrated task. By default, uses kdiff3 for diff tool. Can also specify your own choice of diff tool.
Place the script in /opt/bin/ for global use or $HOME/bin/ for private user access and set permissions so that script execution is allowed: chmod ugo+x /opt/bin/svndiffwrapper
________________________________________
List of graphical diff and merge tools:
• tkdiff: [download] Comes with tkcvs Subversion GUI front-end.
Examples of Subversion diffs with tkdiff: (See: tkdiff --help)
o tkdiff old-URL@revA new-URL@revB
o tkdiff -r457 -r459 file-name
Note: Use command "svn log file-name" to view valid revision numbers for the file. Referencing invalid revision numbers as input to tkdiff will not work.
• gtkdiff: Has diff3 and merge features. Written with GTK+. After gtkdiff-0.8.0, GNOME desktop required.
• diffUse: Diff/merge GUI tool. Good line matching features. Supports Unicode.
• kdiff3: Graphical directory and file diff, merge and edit. KDE3/Qt based. Supports drag and drop. Comes with S.u.S.E. distro. (Cross platform) MS/Windows download available. A very good directory and file diff and merge tool.
o Difference: kdiff3 file1 file2
o Difference: kdiff3 file1 file2 file3
o Difference of two files: kdiff3 directory1/file directory2
o Difference: kdiff3 directory1 directory2
o Merge: kdiff3 directory1 directory2 -o dest-directory
o Merge: kdiff3 file1 file2 -m
o Merge: kdiff3 file1 file2 -o output-file
o Diff with SVN: svn diff -r 457:459 --diff-cmd kdiff3 file-name
• Kompare: Ships with (RHEL4/FC3) KDE SDK. [manual]
• mgdiff: [download] Motif-based graphical file difference browser and merge. Comes with S.u.S.E. distro.
• Meld: Compare, edit and merge.
• fldiff: Graphical file and directory diff. (Cross platform)
• xxdiff: Compare 2 or 3 files and merge. Also compares directories.
• gvim and gvimdiff
________________________________________
Subversion GUI interfaces for Linux:
• TkSVN / TkCVS: Tcl/Tk based GUI. A very good Unix/Linux and MS/Windows GUI front-end to Subversion. Simple to install (requires tk). Supports GUI diff/merge, branching, tagging, editing, check-in/check-out, ...
Installation to /usr/local/bin and lib (Add to your path.): (requires RPM: tk version 8.4+)
o tar xzf tkcvs_8_0_3.tar.gz
o cd tkcvs_8_0_3
o ./doinstall.tcl -nox /opt
Configuration: (See: ~/.tkcvs)
Set default editor and diff tool:
...
set cvscfg(editor) "xterm -e vim"
set cvscfg(tkdiff) "tkdiff"
                   
Also see default config file: /opt/lib/tkcvs/tkcvs_def.tcl
Sets default editors for various file types. Set editor to "gedit" for rookies.
If you want to run TkSVN / TkCVS on MS/Windows, download Tk for MS/Windows. It can also be run from the Cygwin environment using Tk provided in the Cygwin shell.
• Tigris.org: RapidSVN: Dependent on wxWidgets cross platform C++ GUI API.
Download RPMs from Dag Wieers:
o rapidsvn-0.7.2-1.2.el4.rf.i386.rpm
o wxGTK-2.4.2-5.2.el4.rf.i386.rpm
• pysvn: Python subversion front-end. (cross platform) [download]
• eSVN: qt based GUI. Mediocre.
• KdeSvn: KDE front-end.
• Subcommander: Subversion GUI client with visual diff and merge tool with support for different text encodings
• Subview: GTK based subversion (1.3+) client.
• JSVN: Java SVN client
• Syncro SVN Client - Commercial product. Editor, diff tool and SVN client in one integrated tool.
Web Clients:
• Kamikaze-qscm: Web based front-end similar to Mozilla Bonsai.
• WebClient for SVN: Implemented in JSP for Tomcat 4
• ViewSVN: PHP4
• Easy SVN: PERL cgi
Plug-ins:
• NaughtySVN: GNOME Nautilus file browser SVN plug-in.
• Ksvn: Subversion client plugin for the KDE Konqueror browser.
• Eclipse plug-ins:
o Tigris.org: subclipse
Also see: C/C++ development environment and Eclipse
o Subversive
________________________________________
Subversion Security Tips:
One should be aware of a possible Subversion client security hole. The Subversion client authentication will cache your login and password in your home directory in non-encrypted clear text. It will have file system security so others can not read the file however, it still is visible by root or by a root user of the file server if one is used for home directories.
Here are three solutions to reduce this potential security vulnerability:
1. Don't allow Subversion to cache the password: svn commit -F file.txt --no-auth-cache
This will request a username and password but will not store it.
2. Set the Subversion configuration file on server to not cache:
[auth]
store-auth-creds = no
   
3. Delete cached files when you logout. Reduces risk but does not eliminate it. This uses the bash shell logout script to perform a clean-up of the authentication files.
File: ~/.bash_logout
rm ~/.subversion/auth/svn.simple/*
   
________________________________________
Subversion utility commands and scripts:
Command Description
svnversion local-path This svn admin command will produce a compact version number for a working copy. Lists range of versions, adds "S" if switched, "M" modified.
svnchangesince
Shows the changes to the subversion repository since the local copy was last updated.
svnlastlog
Displays the last log message that pertains to the current working copy. Simplified svnlastchange.
svnlastchange
Displays the last log message and a unified diff of the changes made in the last commit.
svn-clean
Removes all the files and directories that are not in Subversion.
List of KDE scripts (See scripts which start with "svn")
________________________________________
Subversion Best Practices:
• ALWAYS compile and test before checking in source code. Subversion revisions should correspond to revisions which compile.
• Don't copy, rename and move directories and files with system shell commands. Use Subversion commands to "rm", "mv", and "add" directories and files and then commit changes when done. Work within Subversion.
• Commit changes as a single logical changeset for one purpose. Thus all code changes for a single bug fix or enhancement should be checked-in together. This allows one to better follow the history log of changes.
o Check-in code at the directory level and all changed files, recursively in the directory and subdirectories will be checked in together.
svn ci -m "Check-in comment goes here" ./
o Check-in files together by specifying them explicitly:
svn ci -m "Check-in comment goes here" file.cpp file2.cpp ...
• Tie Bug tracking and Subversion CM together:
o Use comments when checking-in files into Subversion. Add bug tracking numbers to the comments so Subversion will reference Trac bugs.
o If using Trac, add trac comments so that links are generated to the Subversion repository by placing the Subversion revision number in square braces (i.e. [1140]) in a Trac comment. In this way, Trac will have a direct URL link to Subversion.
• If using Trac integrated with Subversion, refer to the Trac ticket in the Subversion check-in comment using a "#" in front of the Trac ticket number (eg. #65) This generates a hyperlink when the Subversion logs are viewed in Trac.
• Taking code from a Subversion repository for upload to another: Use "svn export" and NOT "svn co" if you want files for upload into another CM repository. A checkout (svn co) will create Subversion management directories (.svn/) in the local working copy. You will not want to upload these directories into a CM system as they are only for the user's local working directory only. An "export" will not create these directories.
• The "tags" branches are NOT to be used as working branches but are snapshots of an existing branch. The "tags" are for historical reference such as a release, well tested version or progress milestone.
• Documentation and related artifacts should not be under the source tree but parallel to it. This isolates the source tree so that email notification triggers sent to developers upon source changes will only go out on source changes or regression build and test systems like Cabie will only rebuild and test on source changes rather than on unrelated documentation changes. 
创建新版本库
svnadmin create /tmp/project-repos

创建dumpfile并压缩
./svnadmin dump ../data/repositories/wasce/ |gzip > test.gz

解压缩
gunzip test.gz

筛选出符合条件的目录并重新导入回dumpfile(筛选时会遇到依赖关系,所以必须把依赖放在前面,看下面的例子)
svndumpfilter include /branches/eBay < test > eBay.dump

导入新的dumpfile(load之前必须知晓所有include进来的分支的结构:必须预先在svn上创建好分支的parent,比如include /branches/wasce_v1.1.0.x/builds2, 必须在svn上创建好/branches/wasce_v1.1.0.x,否则会load失败)
svnadmin load -q /home/svn/repository/pmgbbs < test

************************例子
eBay branch有很多从别的分支copy过来的代码,所以用include eBay是与会有错误的,只能找到一个依赖添加一个,最后成为一下的命令:

/branches/eBay
/external/geronimo-1.1
/external/geronimo-1.1-SNAPSHOT
/branches/geronimo-1.1-SNAPSHOT
/branches/geronimo-1.1
/branches/geronimo-1.0.1

/external/eclipse-plugin-1.2.0
/branches/wasce_v1.1.0.x/builds2

最终命令:
bin/svndumpfilter include /branches/wasce_v1.1.0.x/builds2 /external/eclipse-plugin-1.2.0 /branches/geronimo-1.0.1 /branches/geronimo-1.1 /branches/geronimo-1.1-SNAPSHOT /external/geronimo-1.1-SNAPSHOT /external/geronimo-1.1 /branches/eBay < wombat.svndump_11.06.10 > eBay_dump

Linux virt manager(vm)
vm locations:
vm xml file:  /etc/xen/vm
vm files: /var/lib/xen/images

xm new ce21
xm start ce21

see which vm is running:
ps -ef|grep vnc

virsh

list --all

dumpxml ce20
define /etc/xen/vm/ce20.xml

start ce20

vncpasswd
vncserver :1


can start the manager console:
ssh -X -Y cehost1.cn.ibm.com -l root
virt-manager

can see the server startup via virt manager
add "<graphics type='vnc' listen='127.0.0.1' port='-1'/>" under "<devices>" to xml.
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics