Ponder.cat
  • Communities
  • heart
  • search
    • Login
    • Sign Up
    • Communities

    • heart
      Support Lemmy
    • search
      Search

    • Login
    • Sign Up
    Sjmarf@sh.itjust.works to Programmer Humor@programming.devEnglish · 23 days ago

    Oh no! 🤦‍♂️

    sh.itjust.works

    message-square
    54
    fedilink
    971

    Oh no! 🤦‍♂️

    sh.itjust.works

    Sjmarf@sh.itjust.works to Programmer Humor@programming.devEnglish · 23 days ago
    message-square
    54
    fedilink
    • schnurrito@discuss.tchncs.de
      link
      fedilink
      arrow-up
      33
      ·
      22 days ago

      OK I’ll bite, how do you get rid of a literal ~ directory?

      • barsoap@lemm.ee
        link
        fedilink
        arrow-up
        47
        ·
        22 days ago

        Should be \~ in most shells, certainly bash. Use mkdir and rmdir when messing around to prevent accidents.

        • DacoTaco@lemmy.world
          link
          fedilink
          arrow-up
          11
          ·
          22 days ago

          Saw this post this morning and was thinking about how to delete it ( while falling back asleep ). Escaping the ~, ofc that’d work! I feel so stupid now haha

      • lengau@midwest.social
        link
        fedilink
        arrow-up
        37
        ·
        22 days ago

        rmdir ./~

      • zarkanian@sh.itjust.works
        link
        fedilink
        arrow-up
        14
        ·
        22 days ago

        Just give rm the entire path or a relative path like ./~

      • Raltoid@lemmy.world
        link
        fedilink
        English
        arrow-up
        11
        ·
        edit-2
        22 days ago

        prefix with path, and/or quotation

      • Captain Aggravated@sh.itjust.works
        link
        fedilink
        English
        arrow-up
        8
        ·
        22 days ago

        Using Nautilus or Dolphin.

        • schnurrito@discuss.tchncs.de
          link
          fedilink
          arrow-up
          2
          ·
          22 days ago

          True if these are installed, but if I’m on a server’s command line they probably aren’t.

      • JollyGreen_sasquatch@sh.itjust.works
        link
        fedilink
        arrow-up
        7
        ·
        22 days ago

        A method not yet mentioned is by inode, (I’ve accidentally created filenames I didn’t know how to escape at the time like -- or other command line flags/special characters)

        ls -li

        Once you get the inode

        find . -type f -inum $inode -delete

      • fin@sh.itjust.works
        link
        fedilink
        arrow-up
        1
        ·
        22 days ago

        rm -rf “~” may work?

        • petersr@lemmy.world
          link
          fedilink
          arrow-up
          6
          ·
          22 days ago

          No, but single quotes will.

          • fin@sh.itjust.works
            link
            fedilink
            arrow-up
            2
            ·
            20 days ago

            huh, I almost removed my entire home directory

        • ulterno@programming.dev
          link
          fedilink
          English
          arrow-up
          3
          ·
          22 days ago

          In case you are just testing it out, don’t use -rf
          Your ~ directory is most probably empty, so use rm -d instead, to prevent all footguns in case you put the wrong character in the end.

                 -d, --dir
                        remove empty directories
          

          I feel safe doing rm -d /.
          I feel safe doing sudo rm -d /.

          Because it won’t delete anything that has a file in it.

      • friend_of_satan@lemmy.world
        link
        fedilink
        English
        arrow-up
        1
        ·
        22 days ago

        deleted by creator

        • floquant@lemmy.dbzer0.com
          link
          fedilink
          arrow-up
          29
          ·
          22 days ago

          I don’t understand the eagerness of most people to go nuclear by adding potentially dangerous arguments when not required.

          Use rmdir to remove a directory you expect to be empty, not rm -rf

          • zarkanian@sh.itjust.works
            link
            fedilink
            arrow-up
            1
            ·
            22 days ago

            It’s because they know how to use rm -rf, and they don’t know how to use rmdir. Honestly, I can’t think of a single time I’ve ever successfully removed a directory with rmdir. I always wind up using something else.

        • xav@programming.dev
          link
          fedilink
          arrow-up
          10
          ·
          22 days ago

          In these touchy cases always add ‘-i’ to have a confirmation when doing dangerous things. This will save your ass.

        • Atherel@lemmy.dbzer0.com
          link
          fedilink
          arrow-up
          2
          ·
          22 days ago

          why -exec rm when find has a -delete flag?

          • barsoap@lemm.ee
            link
            fedilink
            arrow-up
            4
            ·
            22 days ago

            Is that some new-fangled GNU thing? It’s certainly not POSIX.

            • Atherel@lemmy.dbzer0.com
              link
              fedilink
              arrow-up
              5
              ·
              22 days ago

              Oh, for once the BSD version has more options than the GNU one.

    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.01K users / day
    • 4.03K users / week
    • 10K users / month
    • 18K users / 6 months
    • 1 local subscriber
    • 24.4K subscribers
    • 909 Posts
    • 16.3K Comments
    • Modlog
    • mods:
    • adr1an@programming.dev
      cake
    • Feyter@programming.dev
    • BurningTurtle@programming.dev
    • Pierre-Yves Lapersonne@programming.dev
    • UI: unknown version
    • BE: 0.19.8
    • Modlog
    • Instances
    • Docs
    • Code
    • join-lemmy.org