• Ephera@lemmy.ml
    link
    fedilink
    English
    arrow-up
    18
    ·
    22 小时前

    This is pretty much the biggest reason why I like fish. It automatically runs Ctrl+R as soon as you start typing and shows it as auto-completion suggestion.
    You would not believe all the things past-me has run in their terminal, that I would never think to Ctrl+R. It’s like the AI stuff the whole IT world rages about, except past-me has real intelligence.

  • tal@lemmy.today
    link
    fedilink
    English
    arrow-up
    43
    ·
    1 天前

    You can list your aliases in bash pretty readily.

    $ alias
    alias emacs='emacs --no-site-file'
    alias ls='ls --color=tty -v'
    $
    
      • tal@lemmy.today
        link
        fedilink
        English
        arrow-up
        6
        ·
        edit-2
        1 天前
        $ git clone https://github.com/sharkdp/vivid.git
        $ cd vivid && cargo build && cd ..
        $ grep -v "^  nord" <vivid/themes/nord.yml >theme-template.yml
        $ csplit theme-template.yml /^colors:/1 -f "theme-template"
        $ sudo apt install cimg-dev
        $ git clone https://github.com/ImageProcessing-ElectronicPublications/palette.git
        $ cd palette
        $ mkdir build && cd build && cmake ../ && cmake --build .
        $ wget https://titis.org/uploads/posts/2022-01/1641518772_4-titis-org-p-nude-breasts-close-up-erotika-4.jpg
        $ convert -crop 2298x1041+1878+1560 1641518772_4-titis-org-p-nude-breasts-close-up-erotika-4.jpg cropped.png
        $ ./build/cpluspalette cropped.png 16 -k|tail -n+2|tr -s '[:cntrl:]' '\n'|sed s/^.//|awk "/.*/ {print \"  nord\"NR-1\": '\"\$0\"'\"}" >../titty-colors.txt
        $ export LS_COLORS=$(../vivid/target/debug/vivid generate <(cat ../theme-template00 ../titty-colors.txt ../theme-template01))
        $ clear
        $ ls
        

        Works for that too.

  • katy ✨
    link
    fedilink
    arrow-up
    3
    ·
    21 小时前

    i like how it’s’ easier for me to do less ~/.bash_history | grep <some part of a command i want to us> instead of just doing an alias.

  • Schiffsmädchenjunge@sh.itjust.works
    link
    fedilink
    arrow-up
    18
    ·
    1 天前

    I just load bash.history in Kate or whatever and ctrl-f the command, copy the line, insert that in the terminal, adapt if necessary and go. Unless it’s one of the last ten or so I used, then it’s just ⬆️⬆️⬇️⬇️⬅️➡️⬅️➡️🅱️🅰️

  • Lazycog@sopuli.xyz
    link
    fedilink
    arrow-up
    23
    ·
    1 天前

    This is why I follow linux memes, I don’t know if I have ever bumped into CTRL+R but I finally can let go of

    history
    
    • tal@lemmy.today
      link
      fedilink
      English
      arrow-up
      16
      ·
      edit-2
      1 天前

      If you haven’t used them before, there’s also ! and ^.

      ! invokes the last command starting with the following string.

      ^ searches for the last command containing the first string, replaces that string with the second, and invokes that.

      $ ls *.mp4
      Episode_One.mp4  Episode_Two.mp4
      $ !l
      ls *.mp4
      Episode_One.mp4  Episode_Two.mp4
      $ ^mp4^mp3
      ls *.mp3
      music.mp3
      $
      
      • Lazycog@sopuli.xyz
        link
        fedilink
        arrow-up
        5
        ·
        1 天前

        I used !<index> Together with history by giving an index displayed in the history list, but did not know that you can use it like that! Also didn’t know about ^

        Thanks for the tips!

    • palordrolap@fedia.io
      link
      fedilink
      arrow-up
      2
      ·
      1 天前

      You say this, but then you discover $HISTTIMEFORMAT which helps records when you last ran a command as a comment in the history file and Ctrl+R won’t tell you that information.

      The hard part with adopting that, though, is editing in plausible looking dates for commands that were issued before it was set up (or choosing not to and dealing with the confusion until those commands disappear off the top of the history).

      • Lazycog@sopuli.xyz
        link
        fedilink
        arrow-up
        1
        ·
        1 天前

        Another awesome tip I’ve learned today, thanks! Yeah often I remember the actual day I typed a specific command but must manually scroll through. This is another useful tip. I don’t think I’ll completely let go of history since it’s also super convenient to just look up index and type !345 for example.

      • tal@lemmy.today
        link
        fedilink
        English
        arrow-up
        8
        ·
        edit-2
        1 天前

        The default ones are the same as in emacs, so if you know emacs, you probably know them too, but Control-U kills (roughly equivalent to “cut” for non-emacs people) from the cursor to the beginning of the line, which emacs doesn’t do; that defaults to something like M-- M-1 C-k in emacs.

        If you’re a vi person, you can do set -o vi and use vi functionality. Hit Esc to go into vi-style command mode.

      • Lazycog@sopuli.xyz
        link
        fedilink
        arrow-up
        1
        ·
        1 天前

        I feel like I forget those that I just don’t use often enough, and when I would need them I default to what I know (which is always a slower way than knowing a shortcut) in a “hurry”.

        Guess I should just print them and tape the paper next to my monitor.

  • Psaldorn@lemmy.world
    link
    fedilink
    arrow-up
    7
    ·
    1 天前

    Using gs, ga and gc for git bullshit has saved me many a keystroke. They show the current status, last log and prompt me for commit message and everything!

  • LordKitsuna@lemmy.world
    link
    fedilink
    arrow-up
    2
    ·
    22 小时前

    I use ctrl+r to the point that for some shorter commands i probably waste more time using it vs just typing it normally

  • Lucy :3@feddit.org
    link
    fedilink
    arrow-up
    6
    ·
    1 天前

    I basically exclusively use Ctrl+R. Even if I need to enter all but one characters of the command in question.

  • tal@lemmy.today
    link
    fedilink
    English
    arrow-up
    4
    ·
    1 天前

    up arrow

    If readline hasn’t been reconfigured from the default emacs mode, you can use Control-P and keep your fingers on the home row.

    • a14o@feddit.orgOP
      link
      fedilink
      arrow-up
      4
      ·
      1 天前

      That’s what I actually use (and ctrl-r also quite a bit), but up arrow for the meme

  • GlenRambo@jlai.lu
    link
    fedilink
    English
    arrow-up
    3
    ·
    1 天前

    Ive been using Kali in a lab lately and the terminal seems to remember commands and prefills them. How do I do Something like that in Mint?

    • a14o@feddit.orgOP
      link
      fedilink
      arrow-up
      5
      ·
      1 天前

      There’s probably many different ways to achieve this but I would probably use a shell (zsh or fish) that does this by default