Lemmy.one
  • Communities
  • Create Post
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
cm0002@lemmy.world to Programmer Humor@programming.dev · 16 天前

Linux Users

lemmy.ml

message-square
150
fedilink
  • cross-posted to:
  • programmerhumor@lemmy.ml
1.32K

Linux Users

lemmy.ml

cm0002@lemmy.world to Programmer Humor@programming.dev · 16 天前
message-square
150
fedilink
  • cross-posted to:
  • programmerhumor@lemmy.ml
alert-triangle
You must log in or # to comment.
  • TabbsTheBat (they/them)@pawb.social
    link
    fedilink
    arrow-up
    91
    ·
    16 天前

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

    • I_Am_Jacks_____@sh.itjust.works
      link
      fedilink
      arrow-up
      39
      ·
      16 天前

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

      • aquovie@lemmy.cafe
        link
        fedilink
        English
        arrow-up
        5
        ·
        16 天前

        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.

      • TabbsTheBat (they/them)@pawb.social
        link
        fedilink
        arrow-up
        3
        ·
        16 天前

        I’ll try it if I don’t forget it by the next time I have access to my PC lol :3

    • tyler@programming.dev
      link
      fedilink
      arrow-up
      22
      ·
      16 天前

      Ctrl + r with fzf and you’ll never go back.

    • sbird@sopuli.xyz
      link
      fedilink
      English
      arrow-up
      2
      ·
      14 天前

      Woah Ctrl R looks super cool, never knew that I could do that before…

  • lmmarsano@lemmynsfw.com
    link
    fedilink
    English
    arrow-up
    58
    ·
    16 天前

    meme: bitches dont know bout ctrl-r
    or documentation.

    • Bash command line editing covers searching.
    • Readline library command line editing covers searching.
    • AmidFuror@fedia.io
      link
      fedilink
      arrow-up
      16
      ·
      16 天前

      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.

      • silasmariner@programming.dev
        link
        fedilink
        arrow-up
        8
        ·
        16 天前

        Not if you have fzf you don’t: https://github.com/junegunn/fzf

        Like an interactive fuzzy finding history. It’s sick.

      • Auli@lemmy.ca
        link
        fedilink
        English
        arrow-up
        2
        ·
        15 天前

        So how well you know which command it is of you won’t recognize it when you see it…

  • B_DL@lemmynsfw.com
    link
    fedilink
    English
    arrow-up
    49
    ·
    16 天前

    I knew there was an

    ls
    

    In there somewhere

    • teletext@reddthat.com
      link
      fedilink
      arrow-up
      10
      ·
      edit-2
      7 天前

      deleted by creator

    • inktvip@lemmy.dbzer0.com
      link
      fedilink
      arrow-up
      3
      ·
      16 天前

      ls … enter ↑ enter ↑ enter

      • ulterno@programming.dev
        link
        fedilink
        English
        arrow-up
        1
        ·
        15 天前

        You may consider using watch ls

        • The Ramen Dutchman@ttrpg.network
          link
          fedilink
          English
          arrow-up
          1
          ·
          9 天前

          I do like that, thanks a lot ulterno!

        • inktvip@lemmy.dbzer0.com
          link
          fedilink
          arrow-up
          1
          ·
          15 天前

          I can’t even keep apart ls and cd it seems.

    • emb@lemmy.world
      link
      fedilink
      arrow-up
      3
      ·
      16 天前

      Now I don’t have to type that in again. Phew!

  • iamdefinitelyoverthirteen@lemmy.world
    link
    fedilink
    arrow-up
    44
    ·
    16 天前

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

    • AmidFuror@fedia.io
      link
      fedilink
      arrow-up
      10
      ·
      16 天前

      Been there, done that.

    • layzerjeyt@lemmy.dbzer0.com
      link
      fedilink
      arrow-up
      5
      ·
      15 天前

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

      • antimidas@sopuli.xyz
        link
        fedilink
        arrow-up
        5
        ·
        15 天前

        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.

        • ulterno@programming.dev
          link
          fedilink
          English
          arrow-up
          1
          ·
          15 天前

          Oh, stuff like git diff and git log will end up being omitted pretty often.
          And a lot of times, the commands that end with piping into less

  • Auli@lemmy.ca
    link
    fedilink
    English
    arrow-up
    38
    ·
    15 天前

    Ctrl R

    • sol6_vi@lemmy.makearmy.io
      link
      fedilink
      arrow-up
      1
      ·
      14 天前

      holy fucking shit 🤌💪🤯❤️💯

  • aeharding@vger.social
    link
    fedilink
    arrow-up
    34
    ·
    16 天前

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

    • Derpgon@programming.dev
      link
      fedilink
      arrow-up
      26
      ·
      16 天前

      CTRL+R for those unitiated

    • Everyday0764@lemmy.zip
      link
      fedilink
      arrow-up
      9
      ·
      16 天前

      reverse-i-search + fzf = <3

    • ulterno@programming.dev
      link
      fedilink
      English
      arrow-up
      0
      ·
      15 天前

      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.

      • dropcase@lemmy.world
        link
        fedilink
        arrow-up
        3
        ·
        15 天前

        why not history | grep -i and the search term?

        even if there are several, you can use ! and the command’s line number to run it again

        • ulterno@programming.dev
          link
          fedilink
          English
          arrow-up
          1
          ·
          15 天前

          history is shell dependent.

  • mvirts@lemmy.world
    link
    fedilink
    arrow-up
    30
    ·
    16 天前

    ^r

    • veni_vedi_veni@lemmy.world
      link
      fedilink
      arrow-up
      14
      ·
      16 天前

      and whenever you forget to sudo: sudo !!

      • Gumus@lemmy.world
        link
        fedilink
        arrow-up
        8
        ·
        16 天前

        You need this: https://github.com/nvbn/thefuck

    • bandwidthcrisis@lemmy.world
      link
      fedilink
      arrow-up
      9
      ·
      16 天前

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

      • 2910000@lemmy.world
        link
        fedilink
        arrow-up
        7
        ·
        16 天前

        No way! I didn’t know you could cycle through the results like that… awesome!

        • bandwidthcrisis@lemmy.world
          link
          fedilink
          arrow-up
          5
          ·
          16 天前

          It’s basically emacs incremental search.

  • Mad_Punda@feddit.org
    link
    fedilink
    arrow-up
    17
    ·
    16 天前

    I’ve probably done that for ls

  • Yggstyle@lemmy.world
    link
    fedilink
    arrow-up
    15
    ·
    16 天前

    taptaptaptap… taptaptaptap… taptaptaptap taptaptaptap taptaptaptap

    … taptaptaptap

    … tap …

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

    • iamdefinitelyoverthirteen@lemmy.world
      link
      fedilink
      arrow-up
      7
      ·
      16 天前

      Or “shit, I did in tmux last time so I could close the terminal window.”

  • killeronthecorner@lemmy.world
    link
    fedilink
    English
    arrow-up
    13
    ·
    16 天前

    O(n) access, very efficient.

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

  • salacious_coaster@infosec.pub
    link
    fedilink
    English
    arrow-up
    13
    ·
    16 天前

    Relevant xkcd: https://xkcd.com/1168/

    • drkt@scribe.disroot.org
      link
      fedilink
      arrow-up
      9
      ·
      16 天前

      tar -xvf <archive-name>

      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

      • nutcase2690@lemmy.dbzer0.com
        link
        fedilink
        arrow-up
        4
        ·
        16 天前

        i just use unar (unarchive) nowadays, since that works with all file formats iirc

      • bitchkat@lemmy.world
        link
        fedilink
        English
        arrow-up
        3
        ·
        16 天前

        Extract a tarball with verbose output from the specified file.

        And learn how to use the ‘z’ option

      • jbrains@sh.itjust.works
        link
        fedilink
        arrow-up
        1
        ·
        15 天前

        You don’t even need the hyphen!

        Mind = blown.

    • Hammerheart@programming.dev
      link
      fedilink
      arrow-up
      7
      ·
      15 天前

      tar --help

    • ominous ocelot@leminal.space
      link
      fedilink
      arrow-up
      4
      ·
      16 天前

      tar - h

      • IsoKiero@sopuli.xyz
        link
        fedilink
        English
        arrow-up
        13
        ·
        edit-2
        16 天前

        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

        • ominous ocelot@leminal.space
          link
          fedilink
          arrow-up
          12
          ·
          16 天前

          Damn.

          • titanicx@lemmy.zip
            link
            fedilink
            arrow-up
            8
            ·
            16 天前

            Thanks, we all died.

            • ominous ocelot@leminal.space
              link
              fedilink
              arrow-up
              6
              ·
              16 天前

              :)

    • psud@aussie.zone
      link
      fedilink
      English
      arrow-up
      1
      ·
      edit-2
      13 天前

      tar -jcvf archive.tbz ~/stuff/*

      Of course I don’t know the bomb had bzip2 on it… I wonder if we can start with ls to see if there’s anything to tar or untar

  • ezekielmudd@reddthat.com
    link
    fedilink
    arrow-up
    12
    ·
    16 天前

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

    • Frezik@lemmy.blahaj.zone
      link
      fedilink
      English
      arrow-up
      13
      ·
      16 天前

      That’s way more mental effort than pressing up a bunch of times.

    • Eager Eagle@lemmy.world
      link
      fedilink
      English
      arrow-up
      8
      ·
      edit-2
      15 天前

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

      • merc@sh.itjust.works
        link
        fedilink
        arrow-up
        3
        ·
        16 天前

        Because you can pipe history to grep.

        • snowe@programming.dev
          link
          fedilink
          arrow-up
          3
          ·
          15 天前

          with fzf you get better grep with fuzzy search

      • Sabata@ani.social
        link
        fedilink
        arrow-up
        2
        ·
        16 天前

        This is going to save me so much time pressing the up arrow.

    • irish_link@lemmy.world
      link
      fedilink
      arrow-up
      2
      ·
      16 天前

      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.

    • Not a newt@piefed.ca
      link
      fedilink
      English
      arrow-up
      2
      ·
      16 天前

      Ctrl-R if you know part of the command.

  • pcouy@lemmy.pierre-couy.fr
    link
    fedilink
    arrow-up
    10
    ·
    16 天前

    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.

    • nameisnotimportant@sh.itjust.works
      link
      fedilink
      arrow-up
      2
      ·
      16 天前

      I was going to talk about it too ! Even though I’m on fish (which helps a lot with history search) atuin really changed my habits and made my life easier !

  • ѕєχυαℓ ρσℓутσρє@lemmy.sdf.org
    link
    fedilink
    arrow-up
    9
    ·
    16 天前

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

    • rozodru@piefed.social
      link
      fedilink
      English
      arrow-up
      5
      ·
      16 天前

      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.

    • RedSnt 👓♂️🖥️@feddit.dk
      link
      fedilink
      arrow-up
      2
      ·
      14 天前

      That’s what I do in bash except for pressing up it’s ctrl+r. FZF does the fuzzy finding for me. It’s so convenient.

  • freewheel@sh.itjust.works
    link
    fedilink
    arrow-up
    9
    ·
    16 天前

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

    • entwine@programming.dev
      link
      fedilink
      arrow-up
      7
      ·
      16 天前

      bash supports this feature too btw

      • freewheel@sh.itjust.works
        link
        fedilink
        arrow-up
        2
        ·
        16 天前

        Added to my mental toolbox, thanks!

Programmer Humor@programming.dev

programmer_humor@programming.dev

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !programmer_humor@programming.dev

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

  • Keep content in english
  • No advertisements
  • Posts must be related to programming or programmer topics
Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 2.21K users / day
  • 5.06K users / week
  • 9.37K users / month
  • 19.1K users / 6 months
  • 197 local subscribers
  • 26.8K subscribers
  • 1.84K Posts
  • 69.2K Comments
  • Modlog
  • mods:
  • Feyter@programming.dev
  • adr1an@programming.dev
  • BurningTurtle@programming.dev
  • Pierre-Yves Lapersonne@programming.dev
  • BE: 0.19.7
  • Modlog
  • Legal
  • Instances
  • Docs
  • Code
  • join-lemmy.org