w9r.de
  • Communities
  • Create Post
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
cm0002@lemmy.world to Programmer Humor@programming.dev · 1 day ago

Linux Users

lemmy.ml

message-square
136
link
fedilink
  • cross-posted to:
  • programmerhumor@lemmy.ml
1.19K

Linux Users

lemmy.ml

cm0002@lemmy.world to Programmer Humor@programming.dev · 1 day ago
message-square
136
link
fedilink
  • cross-posted to:
  • programmerhumor@lemmy.ml
alert-triangle
You must log in or # to comment.
  • Edgarallenpwn@midwest.social
    link
    fedilink
    English
    arrow-up
    5
    ·
    7 hours ago

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

  • janAkali@lemmy.sdf.org
    link
    fedilink
    arrow-up
    4
    ·
    edit-2
    13 hours ago
    • zsh-autosuggestions
    • history | fzf
    • alias cat="bat --plain --theme=gruvbox-dark"
    • zarkanian@sh.itjust.works
      link
      fedilink
      arrow-up
      2
      ·
      edit-2
      6 hours ago

      Aliasing cat or any other ubiquitous shell utility to a replacement is a mistake. Garuda did this, and it was driving me crazy why cat was giving me errors. Turns out that they had aliased bat to cat, and since bat is a different program, it didn’t work in exactly the same way, and an update had introduced some unexpected behavior.

      Drop-in replacements are dumb. Just learn to use a different command.

      • janAkali@lemmy.sdf.org
        link
        fedilink
        arrow-up
        1
        ·
        edit-2
        2 hours ago

        I think it’s ok to add this in a personal .zshrc, not on a distro level:

        If it breaks something - I’d probably know why and can easily fix it by removing alias/calling cat directly.

        Also, scripts almost always use bash or sh in shebang, not zsh. So it only triggers if I type cat in terminal.

  • Auli@lemmy.ca
    link
    fedilink
    English
    arrow-up
    29
    ·
    23 hours ago

    Ctrl R

  • remon@ani.social
    link
    fedilink
    arrow-up
    7
    arrow-down
    1
    ·
    17 hours ago

    You have to be a linux user to use the console now?

  • MashedTech@lemmy.world
    link
    fedilink
    arrow-up
    3
    ·
    18 hours ago

    I just use mcfly

    • xoggy@programming.dev
      link
      fedilink
      English
      arrow-up
      1
      ·
      12 hours ago

      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.

  • aeharding@vger.social
    link
    fedilink
    arrow-up
    31
    ·
    1 day ago

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

    • Derpgon@programming.dev
      link
      fedilink
      arrow-up
      24
      ·
      1 day ago

      CTRL+R for those unitiated

    • ulterno@programming.dev
      link
      fedilink
      English
      arrow-up
      0
      ·
      12 hours ago

      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
        ·
        9 hours ago

        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
          0
          ·
          7 hours ago

          history is shell dependent.

    • Everyday0764@lemmy.zip
      link
      fedilink
      arrow-up
      8
      ·
      1 day ago

      reverse-i-search + fzf = <3

  • lmmarsano@lemmynsfw.com
    link
    fedilink
    English
    arrow-up
    55
    arrow-down
    1
    ·
    1 day ago

    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
      ·
      1 day ago

      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
        ·
        1 day ago

        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
        ·
        22 hours ago

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

  • iamdefinitelyoverthirteen@lemmy.world
    link
    fedilink
    arrow-up
    41
    ·
    1 day ago

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

    • layzerjeyt@lemmy.dbzer0.com
      link
      fedilink
      arrow-up
      5
      ·
      23 hours ago

      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
        4
        ·
        17 hours ago

        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
          ·
          12 hours ago

          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

    • AmidFuror@fedia.io
      link
      fedilink
      arrow-up
      9
      ·
      1 day ago

      Been there, done that.

  • TabbsTheBat@pawb.social
    link
    fedilink
    arrow-up
    86
    ·
    1 day ago

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

    • I_Am_Jacks_____@sh.itjust.works
      link
      fedilink
      arrow-up
      38
      ·
      1 day ago

      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
        ·
        1 day 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.

      • TabbsTheBat@pawb.social
        link
        fedilink
        arrow-up
        3
        ·
        1 day ago

        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
      21
      ·
      1 day ago

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

  • Hammerheart@programming.dev
    link
    fedilink
    arrow-up
    9
    arrow-down
    2
    ·
    1 day ago

    cat ~/.bash_history | grep

    • echindod@programming.dev
      link
      fedilink
      arrow-up
      15
      ·
      23 hours ago

      Useless use of cat?

      • disobey2623@lemmy.dbzer0.com
        link
        fedilink
        arrow-up
        2
        ·
        18 hours ago

        You saying I can just skip cat in that command and it works?

        • x00z@lemmy.world
          link
          fedilink
          English
          arrow-up
          8
          ·
          17 hours ago

          history | grep 'cat'

          • ulterno@programming.dev
            link
            fedilink
            English
            arrow-up
            0
            ·
            12 hours ago

            My output was empty for that command.

            Guess why?
            Because history only gives the last few lines in my system.

        • neox_@sh.itjust.works
          link
          fedilink
          Français
          arrow-up
          5
          ·
          18 hours ago
          grep ~/.bash_history
          
          • disobey2623@lemmy.dbzer0.com
            link
            fedilink
            arrow-up
            4
            ·
            18 hours ago

            How did I not know this. Thank you!

            • oozynozh@sh.itjust.works
              link
              fedilink
              arrow-up
              2
              ·
              13 hours ago

              it’s grep STRING FILE to be precise

              or awk '/STRING/′ FILE if you prefer that for some reason

  • B_DL@lemmynsfw.com
    link
    fedilink
    English
    arrow-up
    47
    ·
    1 day ago

    I knew there was an

    ls
    

    In there somewhere

    • teletext@reddthat.com
      link
      fedilink
      arrow-up
      9
      ·
      edit-2
      1 day ago

      ctrl + r, l, s

      Much faster than simply typing ls!

    • emb@lemmy.world
      link
      fedilink
      arrow-up
      3
      ·
      1 day ago

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

    • inktvip@lemmy.dbzer0.com
      link
      fedilink
      arrow-up
      3
      ·
      1 day ago

      ls … enter ↑ enter ↑ enter

      • ulterno@programming.dev
        link
        fedilink
        English
        arrow-up
        0
        ·
        12 hours ago

        You may consider using watch ls

        • inktvip@lemmy.dbzer0.com
          link
          fedilink
          arrow-up
          1
          ·
          11 hours ago

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

  • mvirts@lemmy.world
    link
    fedilink
    arrow-up
    29
    ·
    1 day ago

    ^r

    • veni_vedi_veni@lemmy.world
      link
      fedilink
      arrow-up
      13
      ·
      1 day ago

      and whenever you forget to sudo: sudo !!

      • Gumus@lemmy.world
        link
        fedilink
        arrow-up
        7
        ·
        1 day ago

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

    • bandwidthcrisis@lemmy.world
      link
      fedilink
      arrow-up
      9
      ·
      1 day ago

      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
        ·
        1 day ago

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

        • bandwidthcrisis@lemmy.world
          link
          fedilink
          arrow-up
          5
          ·
          1 day ago

          It’s basically emacs incremental search.

  • Mad_Punda@feddit.org
    link
    fedilink
    arrow-up
    17
    ·
    1 day ago

    I’ve probably done that for ls

  • salacious_coaster@infosec.pub
    link
    fedilink
    English
    arrow-up
    13
    ·
    1 day ago

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

    • Hammerheart@programming.dev
      link
      fedilink
      arrow-up
      7
      ·
      1 day ago

      tar --help

    • drkt@scribe.disroot.org
      link
      fedilink
      arrow-up
      9
      ·
      1 day ago

      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
        ·
        1 day ago

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

      • jbrains@sh.itjust.works
        link
        fedilink
        arrow-up
        1
        ·
        1 day ago

        You don’t even need the hyphen!

        Mind = blown.

      • bitchkat@lemmy.world
        link
        fedilink
        English
        arrow-up
        3
        arrow-down
        1
        ·
        1 day ago

        Extract a tarball with verbose output from the specified file.

        And learn how to use the ‘z’ option

    • ominous ocelot@leminal.space
      link
      fedilink
      arrow-up
      4
      ·
      1 day ago

      tar - h

      • IsoKiero@sopuli.xyz
        link
        fedilink
        English
        arrow-up
        13
        ·
        edit-2
        1 day ago

        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
          ·
          1 day ago

          Damn.

          • titanicx@lemmy.zip
            link
            fedilink
            arrow-up
            8
            ·
            1 day ago

            Thanks, we all died.

            • ominous ocelot@leminal.space
              link
              fedilink
              arrow-up
              6
              ·
              1 day ago

              :)

  • merc@sh.itjust.works
    link
    fedilink
    arrow-up
    7
    arrow-down
    1
    ·
    1 day ago

    Too many people still use Bash.

    • humorlessrepost@lemmy.world
      link
      fedilink
      English
      arrow-up
      2
      ·
      1 day ago

      I like zsh on mac because pretty colors

    • Leonardo_da_Vinci@lemmy.world
      link
      fedilink
      arrow-up
      1
      arrow-down
      1
      ·
      1 day ago

      Too many distributions still ship with Bash.

      • rtxn@lemmy.world
        link
        fedilink
        arrow-up
        11
        ·
        22 hours ago

        In the real world, the only thing better than perfect is standardized.

      • merc@sh.itjust.works
        link
        fedilink
        arrow-up
        3
        arrow-down
        1
        ·
        edit-2
        1 day ago

        Yeah, true. But, it’s easy to change.

        Bash is the Internet Explorer of shells. It’s great for installing a more useful shell.

        • layzerjeyt@lemmy.dbzer0.com
          link
          fedilink
          arrow-up
          9
          arrow-down
          1
          ·
          23 hours ago

          That’s super unkind and incorrect. IE was a trash software that was widely available because MS was trying to extend their monopoly into new areas.

          Even if it’s not your taste, bash is a mature, stable FLOSS package with wide community support. The reason it is so common is due to it’s positive attributes, not because there is a plot to make it the only choice available to you.

          • calcopiritus@lemmy.world
            link
            fedilink
            arrow-up
            3
            arrow-down
            1
            ·
            22 hours ago

            Bash might be better than IE. But I think we can agree that it is no longer a good shell.

            Its syntax is awful, and lacks many features that other shells have.

            It is only so widely used because it is a de facto standard. If bash was created today, barely no one would us it.

        • pivot_root@lemmy.world
          link
          fedilink
          arrow-up
          2
          ·
          1 day ago

          That’s not true. Internet Explorer was fucking useless for scripting together things, unlike bash.

          • layzerjeyt@lemmy.dbzer0.com
            link
            fedilink
            arrow-up
            4
            ·
            24 hours ago

            Internet Explorer shell expansion always trips me up.

        • Croquette@sh.itjust.works
          link
          fedilink
          arrow-up
          1
          ·
          1 day ago

          What shell do you recommend?

          • merc@sh.itjust.works
            link
            fedilink
            arrow-up
            5
            ·
            1 day ago

            I like zsh, but some people say great things about fish.

            • Auli@lemmy.ca
              link
              fedilink
              English
              arrow-up
              2
              ·
              23 hours ago

              My problem with those is bash is always there and just works.

              • merc@sh.itjust.works
                link
                fedilink
                arrow-up
                3
                arrow-down
                1
                ·
                22 hours ago

                Yes, just like Internet Explorer.

                It’s good to know how to do things in bash, since you’re going to encounter it pretty often. But, that doesn’t mean you shouldn’t customize your shell on the machine(s) you use most often. Why stick with the default when there are better options? You’re just hobbling yourself.

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.4K users / day
  • 5.21K users / week
  • 8.54K users / month
  • 19.8K users / 6 months
  • 1 local subscriber
  • 26.6K subscribers
  • 1.8K Posts
  • 67.9K Comments
  • Modlog
  • mods:
  • Feyter@programming.dev
  • adr1an@programming.dev
  • BurningTurtle@programming.dev
  • Pierre-Yves Lapersonne@programming.dev
  • BE: 0.19.12
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org