2011年5月2日 星期一

Linux Service - SNMP

Compile netsnmp
./configure --prefix=install-path
make

SNMPGET
snmpget
./snmpget -v 2c -c public IP-Address SNMPv2-MIB::sysUpTime.0


SNMPWALK
# ./snmpwalk -v 2c -c public IP-Address 1.3.6.1.2.1.1.1
SNMPv2-MIB::sysDescr.0 = STRING: system-Descriptions
[root@localhost apps]# ./snmpwalk -v 2c -c public IP-Address 1.3.6.1.2.1.1
SNMPv2-MIB::sysDescr.0 = STRING: DOCSIS 3.0 Cable Modem <SNMPv2-MIB::sysObjectID.0 = OID: SNMPv2-SMI::enterprisesOBJECTID
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (1094660) 3:02:26.60
SNMPv2-MIB::sysContact.0 = STRING:
SNMPv2-MIB::sysName.0 = STRING:
SNMPv2-MIB::sysLocation.0 = STRING:
SNMPv2-MIB::sysServices.0 = INTEGER: 2
SNMPv2-MIB::sysORLastChange.0 = Timeticks: (0) 0:00:00.00
SNMPv2-MIB::sysORID.1 = OID: SNMPv2-SMI::zeroDotZero
SNMPv2-MIB::sysORDescr.1 = STRING:
SNMPv2-MIB::sysORUpTime.1 = Timeticks: (0) 0:00:00.00

2011年4月27日 星期三

Adobe PDF

BookMark feature
Select View-> Guide-Board -> Bookmark
Then we can use the embedded bookmarks of the specific pdf document

2011年4月13日 星期三

Linux Command - git

checkout git project
$ git clone git://IP_or_Domain_address/projectName.git
>> Can also be http://IP_or_Domain_address/projectName.git
Cloning into ProjectName...
remote: Counting objects: 13867, done.
remote: Compressing objects: 100% (11779/11779), done.
remote: Total 13867 (delta 2090), reused 13699 (delta 1972)
Receiving objects: 100% (13867/13867), 43.95 MiB | 216 KiB/s, done.
Resolving deltas: 100% (2090/2090), done.

show all the branch/tag in the current repository
$ git ls-remote
From http://IP_or_Domain_address/projectName.git
a99c087c7998b75f8fc662e185b068b52d69b90b HEAD
a99c087c7998b75f8fc662e185b068b52d69b90b refs/heads/master


sync with the latest code from the repository
$ git pull
>> Q. Is there any other command to achieve this purpose?

2011年4月4日 星期一

Linux Command - vi, ctags, taglist

produce the ctags
# ctags -R ./*

Enable the taglist feature
:TlistOpen


my $HOME/.vimrc config file
"set Tlist_Ctags_Cmd=/root/vimfiles/plugin/taglist.vim
filetype plugin on
"let Tlist_Ctags_Cmd = "/usr/bin/ctags"
"let Tlist_WinWidth = 50
map :TlistOpen
map :TlistToggle ==> add the shortcut of taginfo to quickly jump to the taginfo window
map :!/usr/bin/ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .


taginfo howto document
http://vim-taglist.sourceforge.net/manual.html

Linux Command - vim, vimrc example

#將這個檔案放在$HOME/下即可以設定VIM的功能,
#如果你是root,就把它放在/root/.vimrc (命名為.vimrc)即可

set softtabstop=4
set shiftwidth=4
set autoindent

2011年2月21日 星期一

Linux Command - tr

1. translate upper case alphabets to lower case alphabets
# echo "ABCD" | tr [:upper:] [:lower:]
abcd

2. 如何將 dos 檔案格式轉換 unix ? (by using "tr" command)

unix或linux主機上會呈現^M的記號(於windows系統為跳行),

如何執行dos2unix的程序進行格式轉換?

# vi dosfile ==> extra characters in the tailing of each line
aaa^M
bbbb^M
ccccc^M
^Z

use "tr" command to delete the tailed characters


# tr -d "\015\032" <> unixfile



# vi unixfile ==> it is ok now
aaa
bbbb
ccccc


3.
去处^M的方法 tr -s "\015" "\n"
出去M Z的方法 tr -s "\015\032" "\n"

Linux Command - ln

Linux command - ln, create the hard-link or soft-link

standard usage includes the following syntaxs
ln [OPTION]... [-T] TARGET LINK_NAME (1st form)
ln [OPTION]... TARGET (2nd form)
ln [OPTION]... TARGET... DIRECTORY (3rd form)
ln [OPTION]... -t DIRECTORY TARGET... (4th form)

General Usage includes following

a. 1st command type example: create symblic link with specify-name in the specify directory (symbolic link name is differ with target)
# pwd
/tmp
# ln -sf ./mapping-root ./bbb
# ls -la
[omit]
[info-omit] 14 Feb 21 16:40 bbb -> ./mapping-root
[omit]

b. 3rd command type example: create symblic link with the same name with the target in the specify directory (symbolic link name is the same with target)

# ln -sf /tmp/aaa $HOME
# cd $HOME
# ls -la
[info-omit]
8 Feb 21 16:53 aaa -> /tmp/aaa ==>automatically generate the same name with the target in the specify directory ($HOME directory)
[omit]