• 请不要在回答技术问题时复制粘贴 AI 生成的内容
huoru
V2EX  ›  程序员

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

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