lemmy.billiam.net
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
cm0002@lemmy.world to Programmer Humor@programming.dev · 5 months ago

Linux Users

lemmy.ml

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

Linux Users

lemmy.ml

cm0002@lemmy.world to Programmer Humor@programming.dev · 5 months ago
message-square
150
link
fedilink
  • cross-posted to:
  • programmerhumor@lemmy.ml
alert-triangle
You must log in or # to comment.
  • RedSnt 🧩♂️👓🖥️@feddit.dk
    link
    fedilink
    arrow-up
    4
    ·
    5 months ago

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

  • ɔiƚoxɘup@infosec.pub
    link
    fedilink
    arrow-up
    2
    ·
    5 months ago

    Featherpad, copy, paste. Extra work, but you get a work log

  • Endymion_Mallorn@kbin.melroy.org
    link
    fedilink
    arrow-up
    2
    ·
    5 months ago

    I wish this wasn’t so painfully true.

  • Mad_Punda@feddit.org
    link
    fedilink
    arrow-up
    17
    ·
    5 months ago

    I’ve probably done that for ls

  • NullPointer@programming.dev
    link
    fedilink
    English
    arrow-up
    4
    ·
    5 months ago

    zsh tab completion also looks through history wich is pretty nice.

  • B_DL@lemmynsfw.com
    link
    fedilink
    English
    arrow-up
    49
    ·
    5 months ago

    I knew there was an

    ls
    

    In there somewhere

    • inktvip@lemmy.dbzer0.com
      link
      fedilink
      arrow-up
      3
      ·
      5 months ago

      ls … enter ↑ enter ↑ enter

      • ulterno@programming.dev
        link
        fedilink
        English
        arrow-up
        1
        ·
        5 months ago

        You may consider using watch ls

        • The Ramen Dutchman@ttrpg.network
          link
          fedilink
          English
          arrow-up
          1
          ·
          5 months ago

          I do like that, thanks a lot ulterno!

        • inktvip@lemmy.dbzer0.com
          link
          fedilink
          arrow-up
          1
          ·
          5 months ago

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

    • emb@lemmy.world
      link
      fedilink
      arrow-up
      3
      ·
      5 months ago

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

    • teletext@reddthat.com
      link
      fedilink
      arrow-up
      10
      arrow-down
      1
      ·
      edit-2
      5 months ago

      deleted by creator

  • salacious_coaster@infosec.pub
    link
    fedilink
    English
    arrow-up
    13
    ·
    5 months ago

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

    • Hammerheart@programming.dev
      link
      fedilink
      arrow-up
      7
      ·
      5 months ago

      tar --help

    • ominous ocelot@leminal.space
      link
      fedilink
      arrow-up
      4
      ·
      5 months ago

      tar - h

      • IsoKiero@sopuli.xyz
        link
        fedilink
        English
        arrow-up
        13
        ·
        5 months 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
          ·
          5 months ago

          Damn.

          • titanicx@lemmy.zip
            link
            fedilink
            arrow-up
            8
            ·
            5 months ago

            Thanks, we all died.

            • ominous ocelot@leminal.space
              link
              fedilink
              arrow-up
              6
              ·
              5 months ago

              :)

    • drkt@scribe.disroot.org
      link
      fedilink
      arrow-up
      9
      ·
      5 months 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
        ·
        5 months ago

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

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

        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
        ·
        5 months ago

        You don’t even need the hyphen!

        Mind = blown.

    • psud@aussie.zone
      link
      fedilink
      English
      arrow-up
      1
      ·
      edit-2
      5 months ago

      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

  • baltakatei@sopuli.xyz
    link
    fedilink
    arrow-up
    7
    ·
    5 months ago

    $ history | grep 'gre[p]' | less -S

    • mbp@lemmy.sdf.org
      link
      fedilink
      English
      arrow-up
      4
      ·
      5 months ago

      Does fuck all when you can’t remember even a piece of the command lol

      • Auli@lemmy.ca
        link
        fedilink
        English
        arrow-up
        1
        ·
        5 months ago

        Then how well you know which command it is when scrolling. At that point it’s googleing how do I move a file or whatever your looking for.

      • baltakatei@sopuli.xyz
        link
        fedilink
        arrow-up
        1
        ·
        5 months ago

        That’s when you start spamming Page Up/Down, Home, End, and / to search within less. Usually seeing various commands jogs my memory, especially when they are grep commands searching for one I use often enough to be useful but infrequently enough to not remember off the top of my head.

    • FourThirteen@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      5 months ago

      This is the answer

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

    Too many people still use Bash.

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

      Too many distributions still ship with Bash.

      • rtxn@lemmy.world
        link
        fedilink
        arrow-up
        13
        ·
        5 months 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
        ·
        5 months 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.

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

          What shell do you recommend?

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

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

            • Auli@lemmy.ca
              link
              fedilink
              English
              arrow-up
              2
              ·
              5 months ago

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

              • merc@sh.itjust.works
                link
                fedilink
                arrow-up
                4
                arrow-down
                1
                ·
                5 months 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.

        • layzerjeyt@lemmy.dbzer0.com
          link
          fedilink
          arrow-up
          9
          arrow-down
          1
          ·
          5 months 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
            ·
            5 months 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
          ·
          5 months 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
            ·
            5 months ago

            Internet Explorer shell expansion always trips me up.

    • humorlessrepost@lemmy.world
      link
      fedilink
      English
      arrow-up
      2
      ·
      5 months ago

      I like zsh on mac because pretty colors

  • killeronthecorner@lemmy.world
    link
    fedilink
    English
    arrow-up
    13
    ·
    5 months ago

    O(n) access, very efficient.

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

  • ѕєχυαℓ ρσℓутσρє@lemmy.sdf.org
    link
    fedilink
    arrow-up
    9
    ·
    5 months ago

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

    • RedSnt 🧩♂️👓🖥️@feddit.dk
      link
      fedilink
      arrow-up
      2
      ·
      5 months ago

      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.

    • rozodru@piefed.social
      link
      fedilink
      English
      arrow-up
      5
      ·
      5 months 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.

  • aeharding@vger.social
    link
    fedilink
    arrow-up
    34
    ·
    5 months ago

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

    • Derpgon@programming.dev
      link
      fedilink
      arrow-up
      26
      ·
      5 months ago

      CTRL+R for those unitiated

    • ulterno@programming.dev
      link
      fedilink
      English
      arrow-up
      0
      ·
      5 months 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
        ·
        5 months 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
          1
          ·
          5 months ago

          history is shell dependent.

    • Everyday0764@lemmy.zip
      link
      fedilink
      arrow-up
      9
      ·
      5 months ago

      reverse-i-search + fzf = <3

  • Tiberius@lemmy.dbzer0.com
    link
    fedilink
    English
    arrow-up
    4
    ·
    5 months ago

    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

    • merc@sh.itjust.works
      link
      fedilink
      arrow-up
      6
      ·
      5 months ago

      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.

      • snowe@programming.dev
        link
        fedilink
        arrow-up
        1
        ·
        5 months ago

        works in fish shell as well.

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

          deleted by creator

    • JasonDJ@lemmy.zip
      link
      fedilink
      arrow-up
      4
      ·
      5 months ago

      You can use || between two commands as well. If the first command returns exit code != 0, the second command will run.

      I.e. which ansible || pip install ansible.

      • merc@sh.itjust.works
        link
        fedilink
        arrow-up
        4
        ·
        5 months ago

        Or && for if you only want the second command to run if the first command succeeded.

    • TheOakTree@lemmy.zip
      link
      fedilink
      arrow-up
      3
      ·
      5 months ago

      This only works until you grow an addiction to making pho at home and start documenting your progress.

      cd “Pho Recipes and Pictures”

    • DarkAri@lemmy.blahaj.zoneBanned
      link
      fedilink
      arrow-up
      3
      ·
      edit-2
      5 months ago

      cd /

      sudo rm -rf *

      Basically the Linux version of deleting system32 but idk I’m not a super Linux nerd yet.

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

        The fun thing is that you can create a file named “-rf *” and hope an admin tried to delete it!

  • pcouy@lemmy.pierre-couy.fr
    link
    fedilink
    arrow-up
    10
    ·
    5 months ago

    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
      ·
      5 months ago

      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 !

  • lmmarsano@lemmynsfw.com
    link
    fedilink
    English
    arrow-up
    59
    arrow-down
    1
    ·
    5 months 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
      ·
      5 months 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
        ·
        5 months 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
        ·
        5 months ago

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

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.

  • 1.21K users / day
  • 4.51K users / week
  • 8.98K users / month
  • 18.2K users / 6 months
  • 2 local subscribers
  • 30K subscribers
  • 2.13K Posts
  • 82.3K Comments
  • Modlog
  • mods:
  • Feyter@programming.dev
  • adr1an@programming.dev
  • BurningTurtle@programming.dev
  • Pierre-Yves Lapersonne@programming.dev
  • BE: 0.19.14
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org