2010年8月18日 星期三

vi

////////////////////////////////////////////////////////////////////////////
功能:
0. set vi parameter
a. set nowarp = 不換行
b. set nu = show number

1. 取代
:s/patrn/str/cgi搜尋patrn取代str
其中:跟s間必需指定範圍(range)沒設範圍就是游標這行
1,10 表示 1-10行
% 表示整篇
最後cgi
c 表示confirm尋問
g 表示global全部
i 表示ignore不分大小寫
例如:
:%s/\n//g


2. 移動
到第幾個字元??
number + keybale right

3. 整份文件小寫

:%s/.*/\L&/

and in uppercase :

:%s/.*/\U&/
reference:
http://www.lefred.be/?q=node/75
http://unix.t-a-y-l-o-r.com/VBsr.html


4. setting vim
is the home ~/.vimrc
type
{{{
set nowrap
}}}
http://plog.longwin.com.tw/post/1/369


#Reference:
1. http://www.uic.edu/depts/accc/software/unixgeneral/vi101.html
2.

5 Moving

Moving the Cursor
Many commands take number prefixes; for example 5w moves to the right by 5 words.
Type: To Move To:
h one space to the left (also try left arrow)
j one line down (also try down arrow)
k one line up (also try up arrow)
l one space to the right (also try right arrow)
$ end of current line
^ beginning of current line
Enter beginning first word on the next line
G end of file
:n line n; use :0 to move the beginning of the file
w beginning of next word; 5w moves to the beginning of the 5th word to the right
e end of next word
b beginning of previous word
Ctrl-b one page up
Ctrl-f one page down
% the matching (, ), [, ], {, or }
(Press % with your cursor on one of these characters to move your cursor its mate.



2010年8月17日 星期二

CPAN

說明:


//////////////////////////////////////////////////
安裝:
1.
{{{
perl -MCPAN -e shell
}}}
2. ask you problem about the path and some information
//////////////////////////////////
Install a package like List::Compare
{{{
install List::Compare
}}}


Reference:http://www.troubleshooters.com/codecorn/littperl/perlcpan.htm
/////////////////////////////////////////////////

INSTALL EPEL

1. EPEL is the Extra Packages for Enterprise Linux (EPEL) is a volunteer-based community effort from the Fedora project to create a repository of high-quality add-on packages for Red Hat Enterprise Linux (RHEL)



2. you can download it by
> rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm

3. then your reposity will it epel
{{{
[root@localhost yum.repos.d]# pwd
/etc/yum.repos.d
[root@localhost yum.repos.d]# ls
adobe.repo epel.repo sl-debuginfo.repo sl-security.repo
atrpms.repo epel-testing.repo sl-fastbugs.repo sl-srpms.repo
dag.repo sl-contrib.repo sl.repo sl-testing.repo
}}}

////////////////////////////////////////////////
Application:
1. u can download the "ncftp" it is the CPAN the Perl world wide archive of resources
{{{
yum list *ncftp*
yum install
}}}

2. simple use
{{{
ncftp ncftp ftp://ftp.ncbi.nih.gov/toolbox/ncbi_tools++/2010/
(u can use the help to look it)
}}}



///////////////////////////////////////////////////
Reference:
1. epel intro: http://fedoraproject.org/wiki/EPEL
2. epel install: http://www.question-defense.com/2010/01/25/install-ncftp-ncftpget-ncftpput-using-yum-on-centos-linux-server
3.

2010年8月5日 星期四

Network

///////////////////////////
測網路通不通
telnet ip port
ie. telnet www.google.com.tw 80

/////////////////////////
The firwall
{{{
in the /etc/init.d/iptables
}}}

///////////////////////////////
Look the iptble content
{{{
[root@localhost test]# iptables -L -n |
}}}


//////////////////
Look the route information
{{{
[root@localhost rosePC]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.200.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
0.0.0.0 192.168.200.254 0.0.0.0 UG 0 0 0 eth0
}}}

/////////////////////
Look the package
{{{
[root@localhost rosePC]# tcpdump
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes
10:25:07.641993 IP 192.168.200.80.61604 > 239.255.255.250.ws-discovery: UDP, length 993
10:25:07.642419 IP 192.168.200.227.37423 > dns.sinica.edu.tw.domain: 3720+ PTR? 250.255.255.239.in-addr.arpa. (46)
}}}

///////////////////
Look the connection
{{{
[root@localhost rosePC]# netstat -tnlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 2558/portmap
tcp 0 0 0.0.0.0:657 0.0.0.0:* LISTEN 2595/rpc.statd
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 2819/cupsd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 2839/sendmail: acce
tcp 0 0 :::80 :::* LISTEN 8331/httpd
tcp 0 0 :::22 :::* LISTEN 2808/sshd
}}}


//////
查看問題:
http://linux.vbird.org/linux_server/0140networkcommand.php#route

/////
查網卡
ifconfig
{{{
eth0 Link encap:Ethernet HWaddr 00:24:81:95:21:33
inet addr:192.168.200.227 Bcast:192.168.200.255 Mask:255.255.255.0
inet6 addr: fe80::224:81ff:fe95:2133/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:5034520 errors:0 dropped:0 overruns:0 frame:0
TX packets:3121901 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2409215406 (2.2 GiB) TX bytes:926613291 (883.6 MiB)
Interrupt:66 Memory:f3000000-f3010000

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:6679 errors:0 dropped:0 overruns:0 frame:0
TX packets:6679 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:7561716 (7.2 MiB) TX bytes:7561716 (7.2 MiB)

}}}

軟體管理套件

常用的是 yum 或 rpm

///////////////////////////////////
yum
---------- 搜尋 ----------------
> yum list font*

可找出能安裝的 font 字型
---------- 安裝 -------------------
> yum install fonts-korean.noarch

----------- Stop yumupdate------------
> service yum-updatesd stop

/// rpm

[root@localhost tmp]# rpm -ivh hplip-3.10.6_rhel-5.0.i386.rpm
正在準備… ########################################### [100%]
從 /usr/bin/hpijs 安裝的檔案 hplip-3.10.6-0.i386 與來自套件 hpijs-1.6.7-4.1.el5_2.4.i386 的檔案產生衝突
從 /usr/lib/libhpip.so.0.0.1 安裝的檔案 hplip-3.10.6-0.i386 與來自套件 hpijs-1.6.7-4.1.el5_2.4.i386 的檔案產生衝突
從 /usr/lib/sane/libsane-hpaio.so.1.0.0 安裝的檔案 hplip-3.10.6-0.i386 與來自套件 libsane-hpaio-1.6.7-4.1.el5_2.4.i386 的檔案產生衝突
[root@localhost tmp]# rpm -qc hpijs-1.6.7-4.1.el5_2.4
[root@localhost tmp]# rpm -qd hpijs-1.6.7-4.1.el5_2.4
/usr/share/doc/hpijs-1.6.7/COPYING
[root@localhost tmp]# vim /usr/share/doc/hpijs-1.6.7/COPYING
[root@localhost tmp]# rpm -qpR hplip-3.10.6_rhel-5.0.i386.rpm
/bin/sh
/usr/bin/env
/usr/bin/perl
libc.so.6
libc.so.6(GLIBC_2.0)
libc.so.6(GLIBC_2.1)
libc.so.6(GLIBC_2.1.3)
libc.so.6(GLIBC_2.3)
libcrypto.so.6
libcups.so.2
libdl.so.2
libdl.so.2(GLIBC_2.0)
libdl.so.2(GLIBC_2.1)
libgcc_s.so.1
libgcc_s.so.1(GCC_3.0)
libhpip.so.0
libhpmud.so.0
libjpeg.so.62
libm.so.6
libm.so.6(GLIBC_2.0)
libnetsnmp.so.10
libpthread.so.0
libpthread.so.0(GLIBC_2.0)
libpthread.so.0(GLIBC_2.1)
libpthread.so.0(GLIBC_2.3.2)
libsane-hpaio.so.1
libsane.so.1
libstdc++.so.6
libstdc++.so.6(CXXABI_1.3)
libstdc++.so.6(GLIBCXX_3.4)
libusb-0.1.so.4
perl(Cwd)
perl(Data::Dumper)
perl(IO::Handle)
perl(POSIX)
perl(sigtrap)
perl(strict)
python(abi) = 2.4
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
rtld(GNU_HASH)
[root@localhost tmp]# rpm -ivh --nodeps hplip-3.10.6_rhel-5.0.i386.rpm
正在準備… ########################################### [100%]
從 /usr/bin/hpijs 安裝的檔案 hplip-3.10.6-0.i386 與來自套件 hpijs-1.6.7-4.1.el5_2.4.i386 的檔案產生衝突
從 /usr/lib/libhpip.so.0.0.1 安裝的檔案 hplip-3.10.6-0.i386 與來自套件 hpijs-1.6.7-4.1.el5_2.4.i386 的檔案產生衝突
從 /usr/lib/sane/libsane-hpaio.so.1.0.0 安裝的檔案 hplip-3.10.6-0.i386 與來自套件 libsane-hpaio-1.6.7-4.1.el5_2.4.i386 的檔案產生衝突
[root@localhost tmp]# rpm -ivh --force hplip-3.10.6_rhel-5.0.i386.rpm
正在準備… ########################################### [100%]
1:hplip ########################################### [100%]

2010年8月2日 星期一

pidgin

1. it need the certificate of msn, u can update the pidgin

> yum update pidgin.i386