Chinaunix首页 | 论坛 | 博客
  • 博客访问: 82706
  • 博文数量: 18
  • 博客积分: 454
  • 博客等级: 下士
  • 技术积分: 237
  • 用 户 组: 普通用户
  • 注册时间: 2012-03-03 13:38
文章分类

全部博文(18)

文章存档

2012年(18)

分类: LINUX

2012-04-20 12:08:34

0 命令行风格
        原始unix风格
                命令行选项以连字符'-'开头的单个字符。
                后面不带参数的模式标志可以组合在一起。
                -a -b or -ab
                偏爱小写字母,大写字母另有含义。
                以简练为美.
        GNU风格
                两个连字符开头后接关键字。
                如果有选项,空白和'='都可以作为分割。
                --sort=size or --sort size
                容易记忆,但是麻烦。
        X toolkit风格
                略过。
        大多数程序是unix风格和gnu风格混用。
                ls -l --sort size

1 a-z 命令行默认约定
        随着时间的推移,一些字母的含义已经成为一种默认的
        约定,遵循最小立异性原则,应该掌握这种常识。
        -a
                all(ls -a)
                append
        -b
                set buffer/block size (du)
        -d
                debug
                directory(ls -d)
                delete
                diffrent
        -D
                define(gcc -Dmac)
        -e
                execute(sed -e 'command' -e 'command1')
                exclude
                expression
        -f
                file(grep -f file)
                force(rm -rf)
        -h
                header(ps)
        -i
                initialize
                ineractive(rm -i)
        -I
                include(gcc -Ipath)
        -k
                keep(passwd, bzip, fetchmail)
                kill
        -l
                list(ls -l)
                load(gcc -llib)
        -m
                message(git commit -m)
        -n
                number(head -n 1)
        -o
                output(wget)
        -p
                port(ssh)
                protocol(fetchmail)
        -q
                quite(make)
        -r(R)
                recurse(cp)
                reverse(sort)
        -s
                slient(fetmail)
                subject(mail, mutt)
                size
        -t
                tag(vi)
        -u
                user(ps, fetchmail)
        -v
                verbose(tar, cp, cat)
                version(patch)
        -V
                version(gcc, hostname)
        -w
                width(od)
                warning(flex)
        -x
                启用调试 -d
        -y
                yes(yum update -y)
        -z
                启用压缩(bzip, tar)

参看 《unix 编程艺术》Eric S.Raymond 第10章
阅读(2045) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~