Archive for the ‘系统管理’ Category

今天搞网卡千兆,花费一天时间,不总结对不起自己,以下是ethtool的一些总结

ethtool -s speed 1000 duplex full autoneg off  ;强制千兆双工
ethtool eth0                                   ;查看eth0状态
ethtool -s eth0 advertise 0×020         ;设置为全双工1000M
可以设置的advertise参数:
advertise的值:
0×001    10 Half
0×002    10 Full
0×004    100 Half
0×008    100 Full
0×010    1000 Half(not supported by IEEE standards)
0×020    1000 Full
0×8000   2500 Full(not supported by IEEE standards)
0×800    10000 Full
0×03F    Auto
# ethtool eth0
Settings for eth0:
        Supported ports: [ TP ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
        Supports auto-negotiation: Yes
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
        Advertised auto-negotiation: Yes
        Speed: 100Mb/s
        Duplex: Full
        Port: Twisted Pair
        PHYAD: 1
        Transceiver: internal
        Auto-negotiation: on
        Supports Wake-on: g
        Wake-on: d

                [ speed 10|100|1000|2500|10000 ]
                [ duplex half|full ]
                [ port tp|aui|bnc|mii|fibre ]
                [ autoneg on|off ]
                [ advertise %%x ]
                [ phyad %%d ]
                [ xcvr internal|external ]
                [ wol p|u|m|b|a|g|s|d... ]
                [ sopass %%x:%%x:%%x:%%x:%%x:%%x ]
                [ msglvl %%d ]

# ethtool –help
ethtool version 6
Usage:
ethtool DEVNAME Display standard information about device
         ethtool -s|–change DEVNAME    Change generic options
                [ speed 10|100|1000|2500|10000 ]
                [ duplex half|full ]
                [ port tp|aui|bnc|mii|fibre ]
                [ autoneg on|off ]
                [ advertise %%x ]
                [ phyad %%d ]
                [ xcvr internal|external ]
                [ wol p|u|m|b|a|g|s|d... ]
                [ sopass %%x:%%x:%%x:%%x:%%x:%%x ]
                [ msglvl %%d ]
         ethtool -a|–show-pause DEVNAME        Show pause options
         ethtool -A|–pause DEVNAME     Set pause options
                [ autoneg on|off ]
                [ rx on|off ]
                [ tx on|off ]
         ethtool -c|–show-coalesce DEVNAME     Show coalesce options
         ethtool -C|–coalesce DEVNAME  Set coalesce options
                [adaptive-rx on|off]
                [adaptive-tx on|off]
                [rx-usecs N]
                [rx-frames N]
                [rx-usecs-irq N]
                [rx-frames-irq N]
                [tx-usecs N]
                [tx-frames N]
                [tx-usecs-irq N]
                [tx-frames-irq N]
                [stats-block-usecs N]
                [pkt-rate-low N]
                [rx-usecs-low N]
                [rx-frames-low N]
                [tx-usecs-low N]
                [tx-frames-low N]
                [pkt-rate-high N]
                [rx-usecs-high N]
                [rx-frames-high N]
                [tx-usecs-high N]
                [tx-frames-high N]
                [sample-interval N]
         ethtool -g|–show-ring DEVNAME Query RX/TX ring parameters
         ethtool -G|–set-ring DEVNAME  Set RX/TX ring parameters
                [ rx N ]
                [ rx-mini N ]
                [ rx-jumbo N ]
                [ tx N ]
         ethtool -k|–show-offload DEVNAME      Get protocol offload information
         ethtool -K|–offload DEVNAME   Set protocol offload
                [ rx on|off ]
                [ tx on|off ]
                [ sg on|off ]
                [ tso on|off ]
                [ ufo on|off ]
                [ gso on|off ]
                [ gro on|off ]
         ethtool -i|–driver DEVNAME    Show driver information
         ethtool -d|–register-dump DEVNAME     Do a register dump
                [ raw on|off ]
                [ file FILENAME ]
         ethtool -e|–eeprom-dump DEVNAME       Do a EEPROM dump
                [ raw on|off ]
                [ offset N ]
                [ length N ]
         ethtool -E|–change-eeprom DEVNAME     Change bytes in device EEPROM
                [ magic N ]
                [ offset N ]
                [ value N ]
         ethtool -r|–negotiate DEVNAME Restart N-WAY negotation
         ethtool -p|–identify DEVNAME  Show visible port identification (e.g. blinking)
               [ TIME-IN-SECONDS ]
         ethtool -t|–test DEVNAME      Execute adapter self test
               [ online | offline ]
         ethtool -S|–statistics DEVNAME        Show adapter statistics
         ethtool -h|–help

find . -type -f -size +100M 查找大于100m的文件

find . -type f -size +100M  查找大于100m的文件

dos格式文件转换为unix文件格式

dos格式文件传输到unix系统时,会在每行的结尾多一个^M,当然也有可能看不到,但是在vi的时候,会在下面显示此文件的格式,比如 “dos.txt” [dos] 120L, 2532C 字样,表示是一个[dos]格式文件,如果是MAC系统的,会显示[MAC],因为文件格式的原因有时会导致我们的unix程序,或者shell程序出现错误,那么需要把这些dos文件格式转换成unix格式,方法是 vi dos.txt

:set fileformat=unix

:w   这样文件就转换成unix格式文件了, 一般在windows机器上编写好了文件传到unix下就可能会出现这样的情况.  用命令:set ff?  可以看到dos或unix的字样.

  用:set ff=unix把它强制为unix格式,也可以用sed 这样的工具来做:  sed ’s/^M//’ filename > tmp_filename  其中^M是同时Ctrl+V+M按出来的,表示回车。

其它“怪招”:

1. 使用vi

vi dos_file.txt

:%s/^M//g

其中^M 必须是同时按 Ctrl+V+M ,表示回车。不是直接输入 ^M ,那没有用的, :-) 。2. 使用tr

命令:tr -d “\015″ dos_file.txt3. 使用perlcat dos_file.txt | perl -pe ‘~s/\r//g’ > dos_file.txt【VIM】DOS、Mac 和 Unix 文件http://vimcdoc.sourceforge.net/doc/usr_23.html

很久以前,老式的电传打字机使用两个字符来另起新行。一个字符把滑动架移回首位 (称

为回车,<CR>),另一个字符把纸上移一行 (称为换行,<LF>)。

当计算机问世以后,存储器曾经非常昂贵。有些人就认定没必要用两个字符来表示行

尾。UNIX 开发者决定他们可以用 <Line Feed> 一个字符来表示行尾。Apple 开发者规定

了用 <CR>。开发 MS-DOS (以及微软视窗) 的那些家伙则决定沿用老式的 <CR><LF>。

那意味着,如果你试图把一个文件从一种系统移到另一种系统,那么你就有换行符方

面的麻烦。Vim 编辑器自动识别不同文件格式,并且不劳你操心就把事情给办妥了。

选项 ‘fileformats’ 包含各种各样的格式,Vim 会在编辑一个新文件之初尝试该选项

定义的各种格式。例如,下面这个命令告诉 Vim 先尝试用 UNIX 格式,其次,尝试

MS-DOS 格式: :set fileformats=unix,dos编辑一个文件时,你将注意到 Vim 给出的信息消息报中包括文件所用的格式。如果你编

辑的是本地格式文件 (你编辑的文件格式和所用系统一致),你就不会看到任何格式名。

因此在 Unix 系统上编辑一个 Unix 格式文件不会产生任何关于格式的信息。但你若编辑

一个 dos 文件,Vim 将这样通知你: “/tmp/test” [dos] 3L,71C 如果是 Mac 文件,你会看到 “[mac]“。

探测到的文件格式会被存入 ‘fileformat’ 选项。执行下面这个命令可以显示你当前

使用的文件格式: :set fileformat?Vim 能使用的三种格式如下: unix <LF>

dos <CR><LF>

mac <CR>

使 用 MAC 格 式在 Unix 上,<LF> 用于分行。但 <CR> 字符混在文本行中间也非罕见。这种情况碰巧经

常发生在 Vi (和 Vim) 脚本内。

在采用 <CR> 作为换行符的 Macintosh 上,<LF> 字符也有可能混在文本行中间。

结果,很难 100% 肯定一个同时包含 <CR> 和 <LF> 的文件究竟是 Mac 还是 Unix 格

式。所以,Vim 假设你一般不会在 Unix 上编辑一个 Mac 文件,所以干脆对这种文件格

式不作检查。果真要检查此种格式,就把 “mac” 加入 ‘fileformats’: :set fileformats+=mac然后 Vim 就会猜测文件格式。要当心, Vim 可能会猜错的。

强 制 格 式如果你用往日美好的 Vi 来尝试编辑一个采用 MS-DOS 格式的文件,你将会发现每一行的

末尾有个 ^M 字符。(^M 就是 <CR>)。而 Vim 的自动探测功能就避免了这个问题。莫非

你确实要按那个样子来编辑这个文件吗?那么你需要强制 Vim 忽略文件格式而使用你指

定的格式: :edit ++ff=unix file.txt字符串 “++” 告诉 Vim 后面跟的是选项名,以取代其默认值。但仅作用于这一个命令。

“++ff” 用于 ‘fileformat’ 选项。你也可以用 “++ff=mac” 或 “++ff=dos”。

这样用法并非适用于任意选项,目前 Vim 仅仅实现了 “++ff” 和 “++enc”。用全称

“++fileformat” 和 “++encoding” 也行。

转 换你可以用 ‘fileformat’ 选项把文件从一种格式转换为另一种。例如,假定你有个名为

README.TXT 的 MS-DOS 文件,你要把它转换成 UNIX 格式。首先编辑这个采用 MS-DOS

格式的文件:

vim README.TXTVim 将识别出那是一个 dos 格式文件。现在把这个文件的格式改为 UNIX: :set fileformat=unix

:write这个文件就以 Unix 格式存盘了。

北京网通ADSL的两个dnsserver,解析服务器

北京网通ADSL的两个dnsserver,解析服务器
202.106.46.151
202.106.195.68

tar.gz tar.bz2

tar -zxvf filename.tar.gz

tar -jxvf filename.tar.bz2

vi常用快捷操作-不断补充

删除10行esc—10dd   注:方向是从上向下数十行删

复制10行:esc—10yy 注:方向是从上向下复制十行

什么是gnutls库

gnutls库,提供ssl支持的一个库,类似于openssl(貌似授权方式和gnutls不一样,guntls的前缀是gun,看来是GNU的东西)。
说得不一定对,清楚的人帮忙指正。

更改普通用户为root

更改普通用户为root
在/etc/passwd里面将uid 改为0,就可以了。

一些有用命令例子,不断补充中

1、tcpdump -ifxp0 -nnnvvv arp


京ICP备07010914号