top 94 comments

sorted by: hot top controversial new old
[–] 84 points 1 year ago (5 children)

I've been using ctrl + R more now :3.. though I definitely used to ↑↑↑↑↑↑↑

  • source
  • hideshow 5 child comments
  • [–] 37 points 1 year ago (2 children)

    check out fzf (install fzf and add (assuming bash) eval "$(fzf --bash)" to your .bashrc) Makes ctrl+r a superpower

  • source
  • parent
  • hideshow 2 child comments
  • [–] 5 points 1 year ago

    It's awesome until you want to put the cursor in a specific spot of a previous command.

    $ rm -f delete-me.txt
    ctrl-r "me", ctrl-b, ctrl-k
    $ rm -f delete
    

    But I still use fzf because while I used to do the above, fzf offered more advantage that made switching worth it.

  • source
  • parent
  • [–] 49 points 1 year ago (6 children)

    I knew there was an

    ls
    

    In there somewhere

  • source
  • hideshow 6 child comments
  • [–] 3 points 1 year ago (3 children)

    ls .. enter ↑ enter ↑ enter

  • source
  • parent
  • hideshow 3 child comments
  • load more comments (1 reply)
    [–] 43 points 1 year ago (4 children)

    ...until you press up one too many times and enter the same command but with a typo. Again.

  • source
  • hideshow 4 child comments
  • [–] 5 points 1 year ago (2 children)

    There is an option you can set in .zshrc or .bashrc which only includes lines that exit 0 (success)

  • source
  • parent
  • hideshow 2 child comments
  • [–] 4 points 1 year ago (1 child)

    Infuriatingly that would omit things like unit test runners from the history in case they don't pass. As a developer I tend to re-run failed commands quite often, not sure how widely that applies, though.

  • source
  • parent
  • hideshow 1 child comment
  • [–] 31 points 1 year ago (5 children)

    The number of people who don’t reverse-I-search is too damn high

  • source
  • hideshow 5 child comments
  • [–] 0 points 1 year ago (2 children)

    It was quite a while before I realised that was possible.
    Then not long after starting to use it, that I got fed up and just started opening up the history file and searching in it.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 58 points 1 year ago (3 children)
  • [–] 16 points 1 year ago* (2 children)

    To use ctrl-r I have to remember something about the command. To use up arrow I just have to know about how many commands ago I used it.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 27 points 1 year ago (5 children)
  • [–] 9 points 1 year ago (2 children)

    Ctrl-r, l ctrl-r, ctrl-r, ctrl-r, ctrl-r, ctrl-r, ctrl-r, ctrl-r, ctrl-r. To get ls.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 34 points 1 year ago
    [–] 14 points 1 year ago (1 child)

    taptaptaptap.... taptaptaptap.... taptaptaptap taptaptaptap taptaptaptap

    .... taptaptaptap

    ... tap ...

    ... shit I was on a different user when I typed it.

  • source
  • hideshow 1 child comment
  • [–] 13 points 1 year ago

    O(n) access, very efficient.

    No, I do not care to share the value of n

  • source
  • [–] 13 points 1 year ago (11 children)
  • [–] 9 points 1 year ago (3 children)

    tar -xvf

    but only because I had to look it up twice so now my brain has committed it to memory
    I don't even know what it does

  • source
  • parent
  • hideshow 3 child comments
  • [–] 4 points 1 year ago (4 children)
  • [–] 13 points 1 year ago* (3 children)

    Unfortunately that's not valid.

    $ tar -h
    tar: You must specify one of the '-Acdtrux', '--delete' or '--test-label' options
    Try 'tar --help' or 'tar --usage' for more information.
    

    From man-page:

    -h, --dereference follow symlinks; archive and dump the files they point to

  • source
  • parent
  • hideshow 3 child comments
  • [–] 11 points 1 year ago (7 children)

    Or, just type the command “history”, find the index number of the desired command, then type “! ”, then .

  • source
  • hideshow 7 child comments
  • [–] 8 points 1 year ago* (last edited 1 year ago) (3 children)

    or Ctrl+R then search? I don't know why some people still bother with history tbh.

  • source
  • parent
  • hideshow 3 child comments
  • [–] 2 points 1 year ago

    Holy cow!! I didn’t know that. I have been using history > history.txt to find “that one command for that one thing” I only need once every other month or so. Thanks, now I can just do that.

  • source
  • parent
  • [–] 8 points 1 year ago

    I typed it once, I'm not typing it again

  • source
  • [–] 8 points 1 year ago (2 children)

    In fish, you can enter part of the command, and then press up to search for it. It's kinda awesome.

  • source
  • hideshow 2 child comments
  • [–] 5 points 1 year ago

    yeah I ONLY just recently switched to fish after using zsh and oh my zsh for so long - pretty much since first starting linux cause I once saw someone using it on unixporn and I thought "that's cool"

    when I switched to NixOS zsh with all the plugins was a total slog. switched to fish and it just HAS everything that zsh/oh my zsh and the various plugins had but baked in.

    so yeah in Fish it's just starting to type something and hoping it's still in the history.

  • source
  • parent
  • [–] 8 points 1 year ago (2 children)

    Substring completion on ZSH. Type in a small part of the command you want to find and then press up.

  • source
  • hideshow 2 child comments
  • [–] 8 points 1 year ago (1 child)

    https://github.com/atuinsh/atuin is a great tool to manage and search your shell history. I especially enjoy it being able to search commands based on the working directory I was in when I ran them.

    It also has more features (which I don't use) to manage dotfiles and sync shell history across hosts/devices.

  • source
  • hideshow 1 child comment
  • [–] 7 points 1 year ago (4 children)

    Wow this is really validating for me to read. I’ve been using Linux for a few years but I’m definitely not a computer expert and am intimidated by the command line.

    I’ve always felt like googling every command and arrowing up to find an old entry rather than just googling it again marked me as a fake Linux user, not a real one.

  • source
  • hideshow 4 child comments
  • [–] [S] 7 points 1 year ago

    Lol don't feel bad, I can do advanced crazy shit with Linux like pivoting the running OS into RAM so I can unmount the boot drive to do whatever without ever rebooting

    But I still [Web Search] commands a shit ton of the time LMAO

  • source
  • parent
  • load more comments (1 reply)
    [–] 7 points 1 year ago*

    fish has "directory-aware" autocomplete with inlay hints and a fantastic history command. I do not suffer from such weakness

  • source
  • [–] 6 points 1 year ago
    [–] 6 points 1 year ago (1 child)

    I always go past it because I go way to fast.

  • source
  • hideshow 1 child comment
  • [–] 5 points 1 year ago

    I write part of the command then ctrl+r. Using FZF mind you. Such a great utility.

  • source
  • [–] 5 points 1 year ago

    history | grep then !cmd no

  • source
  • [–] 4 points 1 year ago* (3 children)

    grep | history [search term]

  • source
  • hideshow 3 child comments
  • [–] 4 points 1 year ago (2 children)
  • [–] 1 point 1 year ago (1 child)

    Not sure I understand the point of mcfly. zsh and fish have this functionality built in, where pressing Up with a command partially typed will give auto-completions to that partial match.

  • source
  • parent
  • hideshow 1 child comment
  • [–] 1 point 1 year ago

    Yeah. I also use auto-completions for that. McFly does fuzzy finding and because it's a different separate db, for me it works better across many sessions to find commands I had just recently used in another session.

  • source
  • parent
  • [–] 4 points 1 year ago (7 children)

    I accidentally found out one day that I could use a wildcard operator in the terminal instead of a full file or folder name due to always doing this.

    cd Pho* or cd /documents/Pho*

    Will for example open my "Photo Examples" folder in the working directory or based on the path

  • source
  • hideshow 7 child comments
  • [–] 5 points 1 year ago (1 child)

    With ZSH there's something called "path-completion" that makes that even easier.

    Say you want to go to "/usr/local/share/fonts" but that's too much to type out, you can instead type "cd /u/l/s/f" and hit tab. If every path element is unambiguous it will just expand it to "/usr/local/share/fonts". In this case though, "/u/l/" can expand to "/usr/local" or "/usr/lib" so when you hit tab it moves the cursor to just after the "l" to indicate it needs you to distinguish between "/usr/local/" and "/usr/lib". If you just type "o" and hit tab again, it will know that there's only one match for "/usr/lo" and expand that to "/usr/local/" Then there's only one match for "s" which is "share", and only one match for "f" which is "fonts".

    That avoids the danger of executing a command with an asterisk wildcard.

  • source
  • parent
  • hideshow 1 child comment
  • [–] 4 points 1 year ago

    ...Yeah, you got me.

  • source
  • [–] 4 points 1 year ago

    I'm in this picture, and I didn't like it....

  • source
  • [–] 4 points 1 year ago

    Fish once again undefeated. If I want to find that weird image magick command I used earlier with foo.png in it I just type foo.png, hit up and its usually the first one. It doesnt matter where foo.png occurs in the command, fish will find it.

  • source
  • load more comments
    view more: next ›
    16 comments in c/programmerhumor@lemmy.ml view that post