Jan 30, 2008

将Google作为穿墙代理

将Google作为穿墙代理,即当你通过Google的网页版入口访问某个网站时,Google也会作为代理帮你打开。但效果不一样,因为你看到的将会是 手机版布局:

http://www.google.com/gwt/n?u=http://ox0spy.blogspot.com

胡戈新作:007大战猪肉王子












Jan 28, 2008

Linux下查看硬件信息 [zz]

From : http://www.mumonitor.com/blog/?p=376
dmidecode,在linux或者BSD下面执行可以显示很多硬件方面的信息。

不是通过/proc来获取,而是通过读取BIOS信息,可以获得更多更底层的信息。

dmidecode,在linux或者BSD下面执行可以显示很多硬件方面的信息。

如果是品牌服务器,如HP、Dell、IBM等,你可以看到很多相关的信息,包含了硬件的型号,序列号,等等。

如果你想要知道内存有几根,每根的大小,可以查看type为17的几段。这样你就不需要关机然后开机盖来获取这些信息了。

在redhat/centos中,dmidecode已经包含在了kernel-utils的rpm包中,不需要额外安装。很遗憾,默认服务器没有 man的帮助,不过你可以参考dmidecode的官方网站。 里面还提到了相关的脚本,如Prtdiag(bash脚本,只支 持dmidecode1.8及以前的版本),Parse::DMIDecode(perl 的一个模块,提供了获取DMI数据的接口)。


几个好玩的网站

女明星的wiki : http://www.chickipedia.com/index.php/Main_Page

Jan 24, 2008

Happy New Year

happy & test

Jan 21, 2008

[ZT]逆向工程初步(翻译)

逆向工程初步(翻译)

http://bbs.driverdevelop.com/htm_data/100/0708/104632.html
zjg1979

1.完全新手指南
http://www.freewebs.com/fdemunck/newbieproject1.rar

有汇编基础,softice的使用,都是一些基础知识。
http://evilteach.8k.com/

中有四篇文章讲述什么是逆向工程。

2.挑战和指南
http://crackmes.de/在这里有很多合法crackme来测试你的水平。
并且他们是按照难度等级来排序的。

3.指南,杂志,文档,书籍
---win32 api 帮助
http://www.borland.com/devsupport/borlandcpp/patches/BC52HLP1.ZIP ;
这里你可以下载到链接到olly的win32帮助文件。不要认为这是无意义的,
假如你没有,那赶紧下载吧。
---win32基础
http://www.winprog.org/tutorial/index.html ; 这里你可以学到真正的c语言的
win32编程基础。读完他。你对windows了解越多,你在逆向代码的
时候理解的就越到位。
---密码学免费电子书
http://www.cacr.math.uwaterloo.ca/hac/;密码学应用手册,非常酷的免费
的密码学方面的电子书,可以提供完美德在线参考。
---密码学课程
http://www.cs.washington.edu/education/courses/csep590/06wi/
是一整套介绍密码学的课程,是学习密码学一个好的起点。
---密码学指南
http://www.certicom.com/index.php?action=ecc_tutorial,ecc_tut_1_0 ;
非常好的关于椭圆算法的阐述,非常有价值。
---注入代码,一般逆向介绍指南/文档
http://www.codeproject.com/useritems/inject2exe.asp ;
这篇文章包含基本工具(资源黑客,调试器,反汇编器)的使用和如何在可执行文
件中注入代码。
---SEH杂志\指南\文档
hxxp://www.jorgon.freeserve.co.uk/Except/Except.htm ;
---PE格式,反调试,反内存拷贝,Iczelion 的汇编教程
http://www.migeel.sk/anticrack/showpage.php?page=downloads ;
---在Code-Breakers(CBJ)杂志上关于PE头的文章
http://www.secure-software-engineering.com/index.php?option=com_content&task=view&id=60 ;
包含非常详细简明的PE各部分介绍,包括,引入表,导出表,段,目录,资源。由
新手到专家必备。
---PE头参考
http://webster.cs.ucr.edu/Page_TechDocs/pe.txt ;
包含PE头的详细描述,可做资料查找。但是学写PE文件建议读上面的CBJ的文章
---快速汇编参考
hxxp://faydoc.tripod.com/cpu/index_v.htm ;
奔腾cpu汇编指令速查手册。只须点首字母即可选择汇编指令。非常顺手
(假如你将他们下载到本地硬盘).
---网络编程快速向导
hxxp://beej.us/guide/bgnet/output/htmlsingle/bgnet.html ;
快速学习网络编程基础的文章,只需要很短的时间.
---给PE文件增加段,相对虚拟地址/加载修补代码
hxxp://www.sunshine2k.de/Articles.htm ;
包含许多小的,非常基础的PE文章,导入表,dll注入代码

4 语言学习(汇编等)
---汇编语言学习
hxxp://webster.cs.ucr.edu/
HLA的汇编站点。免费电子书《汇编语言的艺术》还有HLA的编译器和一些工具,此
外,还有LINUX部分。
http://www.drpaulcarter.com/pcasm/
有非常好的学习汇编的电子书,如果你不喜欢HLA,那么这是个不错的选择
http://savannah.nongnu.org/projects/pgubook/

汇编教程,甚至有什么是"WORD",AT&T汇编语法
---c++学习
http://www.cplusplus.com/doc/tutorial/ ;
教给你如何使用c++编写注册机,对c++逆向有帮助
---汇编快速开发环境
hxxp://www.radasm.com/ ;
汇编的RAD
---自由的c++/pascal
http://www.bloodshed.net/ ;
如果你想使用免费的编译器开发注册机,可以选用其中一个,C++核心是GNUCPP
---RosASM
http://rosasm.org ;
包含12篇汇编基础教程.

5调试器和反汇编器
---OLLY

http://ollydbg.de/

使用最多的ring3下的调试器,必备
---SYSER
http://www.sysersoft.com/ ;
完美的ring0下的可视化调试器,虽然不是很稳定,但是使用起来非常酷
---WINDBG
http://www.Micro$oft.com/whdc/devtools/debugging/default.mspx
微软的ring0调试器
---IDA

http://www.datarescue.com/ ;
交互式反汇编器,可进行静态分析
---PVDASM

http://pvdasm.reverse-engineering.net/ ;
非常有趣的反汇编工程
---OLLY Plugins

http://woodmann.net/ollystuph/index.php ;
许多od有用的插件
---Shadow's OLLY
hxxp://navig8.to/Shadow/
修改版od,需要付费.

6 训练工具
---FILEMON, REGMON
hxxp://www.sysinternals.com/FileAndDiskUtilities.html

文件,注册表监控
---LordPE
hxxp://www.softpedia.com/get/Programming/File-Editors/LordPE.shtml

可以浏览,修改PE头,段,引入表,目录等

7 linux相关
---NASM反汇编器
hxxp://nasm.sourceforge.net/ ;
开源的跨平台的汇编器
---GNU调试器
hxxp://www.gnu.org/software/gdb/gdb.html/ ;
LINUX和WINDOW均可运行支持远程调试

8 建议读的书(收费)
---逆向:Secrets of Reverse Engineering
逆向工程基础,物有所值
---Rootkits : Subverting the Windows Kernel
高级读物,不适合新手,如果你在逆向方面进步读他,通过其他途径很难学到的技
术他都有清楚地阐述,必备,物有所值

9 高级逆向刊物
---逆向程序分析例子
http://www.honeynet.org/scans/scan33/nico/ ;
讨论 逆向和反逆向技术,从pe头到反调试到虚拟机
---反汇编器和其他工具
hxxp://www.cybertech.net/~sh0ksh0k/projects/ ;
一组有用的工具,包括注入,粘贴,端口重定向
---引入表结构和重定向
hxxp://www.codeproject.com/useritems/inject2it.asp ;

10 网络黑客
hxxp://www.pulltheplug.org/wargames/vortex/ ;
新手练习黑客和编程的战争游戏,教你掌握溢出技术

Jan 17, 2008

/dev/null 误删除

RT,如果把/dev/null误删除,用下面的命令修复

# mknod /dev/null c 1 3

Jan 16, 2008

Ubuntu Tips

1. Boot Options
root=/dev/ram or root=/dev/hda
ramdisk_size=n // 内存大小,单位kb
acpi=off // disable the Advanced Configuration and Power Interface
start_pcmcia=off // disable PCMCIA

2. list all install package
$ sudo dpkg -l | more

3. see what files are included in the package
$ sudo dpkg -L package

4. to identify conflicts before removing a package
$ sudo apt-get -s remove package // -s option says to simulate without
actually donging

5. removing every Gnome package on the system
$ dpkg --get-selections '*gnome*' | awk '{print $1}' | \
xargs sudo apt-get remove

6. burn CD-ROM
$ cdrecord dev=/dev/hdc blank=fast mini.iso

7. when write to a thumb drive, run the sync command. This flushes all
cached data to the disk.
$ sudo sync

8. make FAT file system
a. install the dosfstools package if mkdosfs is not already installed
$ sudo apt-get install dosfstools
b. unmount the drive (for example, /dev/sda1) if it is currently mounted
$ sudo umount /dev/sda1
c. format the drive using either FAT16 or FAT32
$ mkdosfs -F 16 /dev/sda1
$ mkdosfs -F 32 /dev/sda1
note: if you want to creat a FAT-formatted USB floppy drive, then use
the -I option.
For example : $ sudo mkdosfs -I -F 32 /dev/sda

9. convert a large USB floppy device into a small USB floppy device
a. use dd to create a file that is as big as the drive you want to
create. For example, to create a 32MB USB drive.
$ dd if=/dev/zero of=usbfloppy.img bs=32M count=1
b. treat this file as the base device. For example, you can format it
and mount it.
$ mkfs usbfloppy.img
$ sudo mkdir /mnt/usb
$ sudo mount -o loop usbfloop.img /mnt/usb
c. when you are all done configuring the USB drive image, unmount it and
copy it to the real USB
device(for example, /dev/sda). This will make the real USB device appear
as usb floppy device.
$ sudo umount /mnt/usb
$ dd if=usbfloppy.img of=/dev/sda

10. audio convert tools: sox, lame
sox application is a great tool for converting and modifying sound files.
lame is a powerful tool for creating MP3 files.

11. Bash also enables you to edit command lines in either vi or emacs mode.
$ set -o vi # enable vi-mode
$ set -o emacs # enable emacs-mode

12. cool command
a. Ctrl+T/t transposes the last two characters at the cursor. This way,
the common typing error sl can be quickly corrected to ls.
b. The CDPATH variable tells cd where to look when the directory is not
in your current directory.

13. Running Ragged

Ubuntu includes seven different run levels: 0-6 and S. Many of the run
levels provide
very specific services. For example, level 0 is a system halt, 6 reboots
the system, and
S provides the single-user mode. Under Ubuntu, level 1 provides an
alternate single-user
mode environment.

The remaining run levels provide different types of multi-user support.
Usually the system
uses level 2. This provides a graphical user interface (when available)
and network support.
The default level 3 provides support for accessibility devices, such as
a Braille TTY display.
Finally, levels 4 and 5 usually look like level 2, however, you can
modify them if you need
customized run-time environments.

14. Configuring Boot Options
a. services-admin can identify some of the better-know services. It does
not list custom services and does not
identify different run level.
$ services-admin
b. a better tool, sysv-rc-conf
$ sudo apt-get install sysv-rc-conf
$ sudo sysv-rc-conf
note: 1. The sysv-rc-conf command shows most of the system services.
However, it does not show all of them.
If the service's name ends with .sh, contains .dpkg-, or is named rc or
rcS, then it is treated as a
non-modifiable system service. To change these services, you will need
to manually modify the
/etc/init.d/ and /etc/rc*.d/ directory contents
2. there are some essential services. You should not turn off these
services unless you really know what you are doing.

dbus - Provides messaging services.
gdm - This is the Gnome Desktop. Only disable this if you do not want a
graphical desktop.
klogd - This is the kernel log daemon. Removing it disables system logging.
makedev and udev - These create all device nodes.
module-init-tools - Loads kernel modules specified in /etc/modules.
networking and loopback - These start and stop the network. Disabling
removes the network configuration at boot.
procps.sh - Any kernel tuning parameters added to /etc/sysctl.conf are
processed by this service.
urandom - This seeds the real random number generator that is used by
most cryptographic system. You
shouldleave it enabled.

15. simple backup script
a. backup2disk-full
#!/bin/sh
# backup files to disk
# (Be sure to make this executable! chmod a+rx backup2disk-full)
for i in bin boot etc home lib opt root sbin sys usr var ; do
tar --one-file-system -cf - "/$i" 2>/dev/null | \
gzip -9 > /mnt/backup/backup-$i-full.tgz
done

b. backup2disk-inc
#!/bin/sh
# backup files to disk
# (Be sure to make this executable! chmod a+rx backup2disk-inc)
for i in bin boot etc home lib opt root sbin sys usr var ; do
tar --newer /mnt/backup/backup-$i-full.tgz \
--one-file-system -cf - "/$i" 2>/dev/null | \
gzip -9 > /mnt/backup/backup-$i-inc.tgz

c. added the full backup script to my root crontab and configured it to
run once a week
$ sudo crontab -e
Add a line to make the full backup run weekly and the incremental run
daily.
# minute hour day-of-month month day-of-week command
5 0 * * 0 /usr/local/bin/backup2disk-full
5 0 * * 1-6 /usr/local/bin/backup2disk-inc

16. install packages from a shared or local directory:
edit /etc/apt/sources.list
deb file:/mnt/iso dapper main restricted

17. install packages from CD-ROM
a. insert the CD-ROM into the drive
b. run the command
$ apt-cdrom add # the CD-ROM is automatically added to the
/etc/apt/sources.list file

or

a. let's assume that the ubuntu installation CD-ROM is mounted at the
/cdrom
$ apt-cdrom -m -d /cdrom ident
Using CD-ROM mount point /cdrom
Mounting CD-ROM
Identifying.. [d9f91a1075ce140463bf88837cc07be6-2]
Stored label: Ubuntu 6.06 _Dapper Drake_ - Release i386 (20060531)
b. After finding the CD-ROM name, you can add it to the
/etc/apt/sources.list file with a cdrom:resource. For example,
to install the main component, would use:
deb cdrom:[Ubuntu 6.06 _Dapper Drake_ - Release i386 (20060531)]/dapper
main

18. search packages:
a. $ apt-cache search calculator
b. $ apt-cache search calculator calctool

19. show the entire package's description
$ apt-cache show bison

20. list all packages that contains a file
$ dpkg -S `which perl` # list all packages that contains perl

21. /var/log/dpkg.log contains a list of every addition and removal.
This log file is update every time Synaptic, apt, or
dpkg installs or removals packages.


22. 使用中文输入法-- scim-pinyin
$ sudo apt-get install im-switch scim-pinyin
$ sudo apt-get install language-pack-zh
$ export LANG=zh_CN.UTF-8
$ sudo im-switch -s scim-pinyin -z default

23. 关闭蜂鸣
首选,音效,系统响铃,关闭讨厌的蜂鸣声

24. 字体美化
http://wiki.ubuntu.org.cn/%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8XP%E5%AD%97%E4%BD%93%E8%BF%9B%E8%A1%8C%E4%B8%AD%E6%96%87%E7%BE%8E%E5%8C%96


$ sudo mkdir -p /usr/share/fonts/zh_CN/TrueType
$ sudo cp simsun.ttc tahoma.ttf tahomabd.ttf
/usr/share/fonts/zh_CN/TrueType/
$ sudo chmod 644 /usr/share/fonts/zh_CN/TrueType/*
$ cd /usr/share/fonts/zh_CN/TrueType
$ sudo mkfontscale
$ sudo mkfontdir
$ sudo fc-cache /usr/share/fonts/zh_CN/TrueType/ # 更新字体列表
$ sudo cp /etc/fonts/language-selector.conf
/etc/fonts/language-selector.conf.old

将/etc/fonts/language-selector.conf改为:
<fontconfig>
<alias>
<family>serif</family>
<prefer>
<family>Bitstream Vera Serif</family>
<family>SimSun</family>
<family>DejaVu Serif</family>
<family>AR PL ShanHeiSun Uni</family>
<family>AR PL ZenKai Uni</family>
</prefer>
</alias>
<alias>
<family>sans-serif</family>
<prefer>
<family>Bitstream Vera Sans</family>
<family>SimSun</family>
<family>DejaVu Sans</family>
<family>AR PL ShanHeiSun Uni</family>
<family>AR PL ZenKai Uni</family>
</prefer>
</alias>
<alias>
<family>monospace</family>
<prefer>
<family>Bitstream Vera Sans Mono</family>
<family>DejaVu Sans Mono</family>
<family>SimSun</family>
</prefer>
</alias>
<match target="font" >
<test name="family" compare="contains" >
<string>Song</string>
<string>Sun</string>
<string>Kai</string>
<string>Ming</string>
</test>
<test compare="more_eq" target="pattern" name="weight" >
<int>180</int>
</test>
<edit mode="assign" name="embolden" >
<bool>true</bool>
</edit>
</match>
<match target="font" >
<test name="family" compare="contains" >
<string>Song</string>
<string>Sun</string>
<string>Kai</string>
<string>Ming</string>
</test>
<edit name="globaladvance">
<bool>false</bool>
</edit>
<edit name="spacing">
<int>0</int>
</edit>
<edit name="hinting">
<bool>true</bool>
</edit>
<edit name="autohint">
<bool>false</bool>
</edit>
<edit name="antialias" mode="assign">
<bool>true</bool>
</edit>
<test name="pixelsize" compare="less_eq">
<int>18</int>
</test>
<edit name="antialias" mode="assign" >
<bool>false</bool>
</edit>
</match>
<match target="pattern">
<test name="family">
<string>SimSun</string>
<string>SimSun-18030</string>
<string>AR PL ShanHeiSun Uni</string>
<string>AR PL New Sung</string>
<string>MingLiU</string>
<string>PMingLiU</string>
</test>
<edit binding="strong" mode="prepend" name="family">
<string>Tahoma</string>
<string>Verdana</string>
</edit>
</match>
<match target="pattern">
<test name="family"><string>宋体</string></test>
<edit name="family" mode="assign"><string>SimSun</string></edit>
</match>
<match target="pattern">
<test name="family"><string>新宋体</string></test>
<edit name="family" mode="assign"><string>SimSun</string></edit>
</match>
<match target="pattern">
<test name="family"><string>仿宋_GB2312</string></test>
<edit name="family" mode="assign"><string>FangSong_GB2312</string></edit>
</match>
<match target="pattern">
<test name="family"><string>楷体_GB2312</string></test>
<edit name="family" mode="assign"><string>KaiTi_GB2312</string></edit>
</match>
<match target="pattern">
<test name="family"><string>黑体</string></test>
<edit name="family" mode="assign"><string>SimHei</string></edit>
</match>
</fontconfig>

然后,设置字体渲染为单色 系统 --> 首选项 --> 字体

25. 不让Ctrl-Alt-Backspace组合键重启X
$ sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf.old
$ sudo vim /etc/X11/xorg.conf # 在文件末尾添加下面内容
Section "ServerFlags"
Option "DontZap" "yes"
EndSection

note : 重启GNOME生效

26. 解决pdf中文乱码问题
$ sudo apt-get install xpdf-chinese-simplified
如果上面的方法仍然不起作用,你需要安装poppler-data

27. 安装Ati 驱动
http://shine-woods.blogspot.com/2007/05/atifeistyaiglxberyl.html
RV280 bug
https://help.ubuntu.com/community/Radeon_9200/9250_%28RV280%29_and_DVI

28. 多媒体支持
mp3 :
a. ffmpeg package from the universe repository
b. vorbis-tools package from the restricted repository.
MPEG, AVI, QuickTime, and other video formats : mjpegtools package
MPEG4 : libxvidcore4 and faad packages
Windows Codecs : w32codecs package
DVD : libdvdcss2

29. flash支持
$ sudo apt-get install flashplugin-nonfree
$ sudo update-flashplugin

30. play video in browser
$ sudo apt-get install totem-gstreamer-firefox-plugin
or
$ sudo apt-get install totem-xine-firefox-plugin

31. 安装字体
Chinese is supported through a variety of font packages including
ttf2pt1- chinese, ttf-arphic-ukai,
ttf-arphic-uming, xfonts-cmex-big5p, xfonts-intl-chinese, and
xfonts-intl-chinese-big.

The msttcorefonts package provides the core TrueType fonts found on
Microsoft systems
安装完字体运行:
$ sudo fc-cache -f -v # scan and list the font directories, and update
the shared font information

32. 源码的形式安装软件
$ sudo apt-get install dpkg-devpackage # 以源码的形式安装软件所必需的
$ apt-get source package_name # 下载源码
$ apt-get --compile source package_name # 自动编译源码

33. integrated development environment (IDE) :
anjuta # design for c/c++ software develop.
eclipse-cdt # eclipse for c develop tool.

34. install thunderbird2
1. Download Thunderbird 2. (Save to disk)
2. sudo tar -C /opt -zxvf ~/Desktop/thunderbird-*
3. sudo ln -s /opt/thunderbird/thunderbird /usr/local/bin/thunderbird
4. create a menu item: sudo gedit
/usr/share/applications/thunderbird.desktop

[Desktop Entry]
Encoding=UTF-8
Name=Thunderbird
Comment=Thunderbird Mail Client
Exec=thunderbird
Icon=/opt/thunderbird/icons/mozicon16.xpm
StartupNotify=true
Terminal=false
Type=Application
Categories=Applications;Network

35. ssh tips
转发X
$ ssh -X user@server
转发单一的应用程序,比如firefox
$ ssh -XC user@server firefox // -C 压缩数据
转发整个桌面
$ xinit -e ssh -XCT user@server gnome-session -- :1 // 在字符界面输入该命令
注: 如果想转发X,确定机器的/etc/ssh/sshd_config 中的X11Forwarding为yes

$ ssh -fCT user@server <command> // run a single command on the open-ssh
server
-f = Allows ssh to close after the connection is established.
-C = Use Compression
-T = No terminal session will be started

36. smbclient tips
smbclient 是Samba 的Linux 客户端,在Linux机器上用来查看服务器上的共享资
源,也可以象FTP一样,用户可以登录Samba服务器,
也可以上传put和下载get文件
1) 查看服务器上的资源
$ smbclient -L //192.168.1.5 -U administrator // smbclient -L //IP [-U
username]
2) 登录Samba服务器
$ smbclient //IP/共享文件夹 -U usrename // -U 用户名表示Samba 的用户;
note : 登录到Samba服务器上,就可以用smbclient的一些指令,可以象用FTP指令
一样上传和下载文件;

37. smbtar - for remote backup/restore
backup
$ smbtar -t archive.tar -s winServer -x big // 备份主机名为winServer上的
big共享
$ smbtar -t - -s winServer -x big | gzip -9 > archive.tar.tgz // 压缩
restore
$ smbtar -r -t archive.tar -s winServer -x big // 恢复备份
$ zcat archive.tar.tgz | smbtar -r -t - -s winServer -x big
注: windows不允许SMB访问系统目录和注册表

38. smbmount - 挂载共享文件
$ sudo apt-get install smbfs
$ sudo mkdir /mnt/smb
$ sudo smbmount //winServer/big /mnt/smb
注: smbmount <=> mount -t smb
$sudo umount /mnt/smb

39. 架设samba 服务器
1) Install samba
$ sudo apt-get install samba samba-common
2) Adding Samba Shares
$ sudo mkdir -p /home/shares/all
$ sudo chmod -R a+rwxt /home/shares/all
3) Adding and managing users
$ sudo useradd administrator -m -G users
$ sudo passwd administrator
$ sudo smbpasswd -a administrator // add user to samba user database
4) edit config file —— /etc/samba/smb.conf
In the global section, remove the ";" at the front of the line security
= user so it looks like this:
security = user

At the end of the file /etc/samba/smb.conf add the following lines:
[allusers]
comment = All Users
path = /home/shares/all
valid users = @users
force group = users
create mask = 0700
directory mask = 0700
writable = yes

If all users shall be able to read and write to their home directories
via Samba, add the following lines to /etc/samba/smb.conf:
[homes]
comment = Home Directories
browseable = no
valid users = %S
writable = yes
create mask = 0700
directory mask = 0700

5) OK, now restart you Samba
$ sudo /etc/init.d/samba restart

40. 访问Windows远程桌面(remote desktop)
这些工具都可以:rdesktop, gnome-rdp(for gnome), tsclient, krdc (for kde)

41. 系统资源查看
CPU
$ cat /proc/cpuinfo // cpu 硬件信息
$ uptime // cpu负载
$ top // 每个程序占用cpu的动态详细信息
$ ps aux // 类似top,是静态的
磁盘
$ fdisk -l // 显示每个磁盘分区
$ df -h // 以human-readable的形式显示磁盘使用情况
$ mount // 各分区的挂载点
$ du -h // disk-usage, 以human-readable的形式显示文件夹所占用的磁盘空间
$ du -h | sort -rn | head // 显示占用磁盘空间最多的10个文件夹
磁盘I/O
$ sudo apt-get install sysstat
$ iostat
$ watch --interval 0.5 iostat
$ lsof / (or /dev or /dev/hda) // 查看那个进程使用设备/文件
$ fuser // identify processes using files or sockets
内存
$ swapon -s // 显示可用的swap
$ pmap // 显示分配给具体pid的内存
$ ps aux
$ top
显存
$ lspci -v
$ lspci -t
网络
$ netstat -i inet
$ netstat -t // 显示tcp连接
$ netstat -u // 显示udp连接
$ netstat --protocol=ip // 显示所有的ipv4连接
$ netstat --protocol=ip6 // 显示ipv6连接
$ watch --interval 0.5 netstat -i inet
$ ifconfig eth0
lsof 显示那个进程使用网络
$ lsof -i4 // 显示那个进程使用ipv4
$ lsof -i6 // ...ipv6
$ lsof -i4 -n // 显示那个进程使用ipv4,并且以数字的形式表示ip地址
$ lsof -i tcp // 与上面类似
$ lsof -i udp

42. 运行级
查看
$ who -r
$ runlevel
注: 所有/etc/init.d/中的脚本的启动信息都写到/var/log/messages
改变
$ telinit runlevel
注: 改变运行级之前先执行所有的K(for kill)脚本

43. 动态设备配置
udev管理动态设备配置,udev进程检测并管理即插即用(plug and play)设备
配置文件: /etc/udev/rules.d/


44. autostart program
1) boot script: locate in /etc/init.d/
2) shell startup scritp
system-wide: /etc/bash.bashrc, /etc/profile
user-specific: ~/.bash_profile, ~/.bashrc
note: execute when user logout: /etc/bash.logout, ~/.bash_logout
3) desktop script: /etc/X11/Xsession, /etc/X11/Xsession.d/, ~/.gnomerc,
~/.Xsession
System -> Preferences -> Sessions // Gnome desktop
4) device startup:udev (watches and manages plug-and-play devices).
Configuration file in /etc/udev/rules.d/
note: System -> Preferences -> Removable Drives and Media // Gnome desktop
5) network services: /etc/network/
6) schedulers: at, cron, and anacron

45. view current kernel settings and adjust them.
wiew
$ sudo sysctl -a | sort | more
two ways to adjust the kernel parameters
$ sudo sysctl -w kernel.threads-max=20000 // this change takes effect
immediately but is not permanent. After reboot changes will be lost.
$ add "kernel.threads-max=20000" to /etc/sysctl.conf // this change
takes effect on the next reboot.

46. modifying shared memory
$ ipcs -m
$ ipcs -m -p
$ ipcrm
$ sudo sysctl kernel | grep shm

47. changing per user setting
$ ulimit -a // show current setting
$ ulimit -c 100 // enable core dumps, core size is 100 blocks.
note: 1) regular user cannot change some limit.
2) some values have an upper limit define by kernel.

48. files convert
DOC files to text : antiword
PDF files to text : xpdf-utils (provides pdftotext)
graphic converion : netpbm (provides programs such as giftopnm,
jpegtopnm, pnmtopng, pnmtogif, and pnmtojpeg)

49. a useful tools - dnotify
watches a specified directory for any change. A change may be a file
creation, update, renaming, deletion,
or permission modification. When a change happens, dnotify can run a
script.

50. network services
$ netstat | most
note : two states
ESTABLISHED - a network connection exist between the two systems.
TIME_WAIT - a connection has terminated and the system is just waiting
for any final packets before
tearing down the connection.

$ netstat -l | most // show all the listening servers
$ netstat -lt // show all tcp services
$ netstat -lu // show all udp services
$ netstat -lx // show the local unix services and sockets

$ sudo apt-get install nmpa
$ sudo nmap -sS -sV -p 0-65535 -O localhost

51. fcitx 安装
$ sudo apt-get install language-pack-zh // if not install chinese
language package
$ sudo apt-get install im-switch fcitx
$ im-switch -s fcitx -z default
英文locale下fcitx输入设置
修改/etc/gtk-2.0/gtk.immodules
找到
"/usr/lib/gtk-2.0/2.10.0/immodules/im-xim.so"
"xim" "X Input Method" "gtk20" "/usr/share/locale" "ko:ja:th:zh"
改为下面这样
"/usr/lib/gtk-2.0/2.10.0/immodules/im-xim.so"
"xim" "X Input Method" "gtk20" "/usr/share/locale" "en:ko:ja:th:zh"

英文界面下输入栏与输入文字为方块,而且修改~/.fcitx/config的字体:显示字
体(中)=SimSun 仍然是小方块
改为 显示字体(中)=AR PL ShanHeiSun Uni
tips : 1. fcitx修改配置文件后,在输入法处于激活状态下,只需按Ctrl+5即可加
载新的配置文件(无须重启X或是kill後再加载)
2. 锁定输入法:fcitx输入法的面板上有把小锁的图表,点击它使之变成红色时,将
无法通过ctrl+shift切换到其他输入法,点击它使之
变灰色时则可进行输入法之间的切换,对于单一输入法用户来说可避免误按ctrl+
shift的麻烦了.
3. 去掉多余的输入法
修改~/.fcitx/config,去掉双拼和区位
[输入法]
使用拼音=1
使用双拼=0
使用区位=0
使用码表=0
提示词库中的词组=1
$ sudo mv /usr/share/fcitx/data/tables.conf
/usr/share/fcitx/data/tables.conf // 去掉其他输入法
OK,现在就只剩下拼音输入法了

Jan 11, 2008

Install pidgin at ubuntu 7.04 (feisty) by compile via source

我的机器装上ubuntu 7.10就花屏,而ubuntu 7.04默认安装的是gaim,所以只能自己动手了

1. 下载pidgin源码 pidgin-2.3.1.tar.bz2
2. 安装一些包
    $ sudo apt-get install libgtk2.0-dev libxml2-dev libnss-dev libglib2.0-dev libgnutls-dev
3. 编译, 安装
    $ ./configure --enable-gnutls=yes
    注: 如果不加--enable-gnutls=yes, 可以顺利安装但登录msn时提示 : SSL support is needed for MSN. Please install a supported SSL library.
    $ make
    $ sudo make install && make clean