V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
Myarms
V2EX  ›  Linux

请问大家怎么啃 man page?

  •  
  •   Myarms · 2015-05-14 08:55:30 +08:00 via Android · 4428 次点击
    这是一个创建于 3262 天前的主题,其中的信息可能已经有所发展或是发生改变。
    比如想了解ls 的-a选项,英文好难理解啊。
    有时感觉中文都难看懂。
    第 1 条附言  ·  2015-05-14 10:00:04 +08:00
    不好意思,忘了贴上来

    expression [-a] expression

    Conjunction of primaries; the AND operator is implied by the juxtaposition of two primaries or made explicit by the optional -a operator. The second expression shall not be evaluated if the first expression is false.
    35 条回复    2015-05-15 17:29:55 +08:00
    krizex
        1
    krizex  
       2015-05-14 08:56:46 +08:00
    -a, --all
    do not ignore entries starting with .
    不忽略以.开头的项
    krizex
        2
    krizex  
       2015-05-14 08:57:16 +08:00
    LZ我的英语水平是4级。。。
    blank4me
        3
    blank4me  
       2015-05-14 08:59:58 +08:00
    我比较在意有没有机智的方法直接调跳到-a
    直接搜索太慢了,经常搜到奇奇怪怪的地方,比如什么--add之类的
    abscon
        4
    abscon  
       2015-05-14 09:02:00 +08:00
    @blank4me /-a\>
    foxni
        5
    foxni  
       2015-05-14 09:03:21 +08:00
    有些时候不得不看,所以就慢慢看喽。。。看着看着就习惯了。
    Septembers
        6
    Septembers  
       2015-05-14 09:06:56 +08:00
    敲着敲着就变下意识了
    newborn
        7
    newborn  
       2015-05-14 09:11:46 +08:00
    @blank4me Linux里头查看man默认调用的less,less支持按下/进行搜索,搜索可以用正则表达式匹配。按n和N切换下、上一个匹配项目
    Myarms
        8
    Myarms  
    OP
       2015-05-14 09:14:27 +08:00 via Android
    不好意思,忘了贴上来

    expression [-a] expression

    Conjunction of primaries; the AND operator is implied by the juxtaposition of two primaries or made explicit by the optional -a operator. The second expression shall not be evaluated if the first expression is false.
    Myarms
        9
    Myarms  
    OP
       2015-05-14 09:15:05 +08:00 via Android
    我打错了是find
    kingwrcy
        10
    kingwrcy  
       2015-05-14 09:16:46 +08:00   ❤️ 4
    Myarms
        11
    Myarms  
    OP
       2015-05-14 09:22:15 +08:00 via Android
    @kingwrcy 这个不错,感谢。
    provides examples of common uses of command line tools.
    TimLang
        12
    TimLang  
       2015-05-14 09:24:48 +08:00
    实在看不懂去买本 linux命令行大全吧,常用命令肯定都有详细的解释。
    stormslowly
        13
    stormslowly  
       2015-05-14 09:26:25 +08:00
    ```
    man ls | col -bx > ls.man.page.txt
    ```

    用自己喜欢的编辑查看man page的内容吧。。。
    xi4oh4o
        14
    xi4oh4o  
       2015-05-14 09:50:13 +08:00   ❤️ 1
    lavande
        15
    lavande  
       2015-05-14 10:09:00 +08:00
    有些man写得感觉很晦涩,还是google一下具体用法比较舒服……
    Jaylee
        16
    Jaylee  
       2015-05-14 10:09:55 +08:00
    cheat
    zhoulujue
        17
    zhoulujue  
       2015-05-14 10:13:23 +08:00
    man page 里首先看 examples,再结合用法description,基本上几分钟就能找到你要的功能了。但是有一些命令是没有example的。。。
    wilsoncao
        18
    wilsoncao  
       2015-05-14 10:26:15 +08:00
    终于有人问出这个问题了!!
    @kingwrcy 感谢回答!
    abscon
        19
    abscon  
       2015-05-14 10:30:09 +08:00
    @newborn 根据他的回复,他显然知道你说的这些。他不知道的是 \< \>这种用法。
    要用 \> 把 -a 截断,否则会匹配到 --add -all 之类的
    xxx027
        20
    xxx027  
       2015-05-14 13:14:20 +08:00
    偶尔会用用这个: http://linux.51yip.com/ : )
    Linusyeung
        21
    Linusyeung  
       2015-05-14 14:30:19 +08:00 via iPhone
    学习了…

    我都是直接刷英文…

    先看例子,别急躁…
    blank4me
        22
    blank4me  
       2015-05-14 14:51:37 +08:00
    @abscon 实测不行诶,搜gcc里的-g,输入/-g\>显示pattern not found。
    \>这种用法不是vim才有的?
    blank4me
        23
    blank4me  
       2015-05-14 15:02:16 +08:00   ❤️ 1
    @abscon
    http://unix.stackexchange.com/questions/67063/exact-match-in-regrex-when-using-vim-man-or-less
    less貌似是用\b代替vim里的\>
    谢谢你给的思路,感觉被拯救了一大截 T_T
    byron
        24
    byron  
       2015-05-14 15:24:51 +08:00
    cheat
    byron
        25
    byron  
       2015-05-14 15:26:13 +08:00
    cheat
    你值得拥有。
    abscon
        26
    abscon  
       2015-05-14 15:26:19 +08:00   ❤️ 1
    @blank4me 正则表达式中用 \b 表示词边界是 Perl 风格,用 \< \> 则是 vim 风格。

    你说实测不行,说明你系统上的 less 用的 regex 是 Perl 的。但我的系统上 less,grep,和 vim 都是统一用 \< \>。

    我用的是 FreeBSD。刚才也实测了一下Linux, CentOS 5.4 上 less 也是 \< \>,CentOS 6.4 的则是 \b
    ilotuo
        27
    ilotuo  
       2015-05-14 16:00:12 +08:00
    为毛我osx
    /-a\> /-a\b 都不行
    lsmgeb89
        28
    lsmgeb89  
       2015-05-14 16:18:40 +08:00
    这英文算不算难的,提高下英语水平。
    bonefish
        29
    bonefish  
       2015-05-14 18:26:20 +08:00   ❤️ 1
    https://github.com/idank/explainshell

    很酷的工具, 把命令输进去,立刻把整条命令解释出来。比如:
    http://explainshell.com/explain?cmd=ls+-a
    zhengkai
        30
    zhengkai  
       2015-05-14 18:45:58 +08:00
    @bonefish 不错,可我试了一个给解释错了

    http://explainshell.com/explain?cmd=wget+-rmnp+http%3A%2F%2Fwww.163.com

    其实 -np 是一个参数,结果给解释成 -p 和一个未知的 -n

    虽然参数格式是奇怪了点,但是 wget 也算常见工具了
    bonefish
        31
    bonefish  
       2015-05-14 19:06:29 +08:00
    @zhengkai 看来对多字母支持不好,或许你可以提交个bug,已经有个类似的bug report:
    Does not recognise multi-letter GCC options
    https://github.com/idank/explainshell/issues/113
    lzmbbg
        32
    lzmbbg  
       2015-05-14 21:25:24 +08:00
    man page不是有个中文么。
    zhengkai
        33
    zhengkai  
       2015-05-14 21:43:53 +08:00
    @bonefish 提交了,不过这个 issue 已经半年了也没人理,囧
    sadhen
        34
    sadhen  
       2015-05-15 17:29:20 +08:00
    https://github.com/man-pages-zh

    man page 的中文翻译维护计划。前一段时间开始做的。
    sadhen
        35
    sadhen  
       2015-05-15 17:29:55 +08:00
    @lzmbbg 目前的中文man page内容上老旧,排版上也有问题
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1253 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 17:51 · PVG 01:51 · LAX 10:51 · JFK 13:51
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.