ExLisper Site
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
not_IO@lemmy.blahaj.zone to linuxmemes@lemmy.worldEnglish · 2 months ago

after every cd

media.mas.to

message-square
24
link
fedilink
702

after every cd

media.mas.to

not_IO@lemmy.blahaj.zone to linuxmemes@lemmy.worldEnglish · 2 months ago
message-square
24
link
fedilink

https://mas.to/@changoteca/115940445541109805

alert-triangle
You must log in or # to comment.
  • wildbus8979@sh.itjust.works
    link
    fedilink
    arrow-up
    58
    ·
    2 months ago

    Let me teach you about reverse-i-search in bash…

    https://linuxvox.com/blog/ctrl-r-linux/

    • RollForInitiative@feddit.org
      link
      fedilink
      arrow-up
      32
      ·
      2 months ago

      Yep, thats a good one. Another one, ALT + . inputs the last argument from your last command, pressing it multiple times cycles thorough your past arguments.

      • wildbus8979@sh.itjust.works
        link
        fedilink
        arrow-up
        13
        ·
        2 months ago

        Nice, 30 years and I didn’t know this one. I always use the $! for the last argument.

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

          I’ve never heard of $! but we use Macs at work. Alt+. doesn’t work so I’ve been using $_.

          • softwarist@programming.dev
            link
            fedilink
            English
            arrow-up
            4
            ·
            2 months ago

            ⌥+. does the trick for me on MacOS.

            • toynbee@lemmy.world
              link
              fedilink
              arrow-up
              1
              ·
              2 months ago

              Sorry, I should have been more clear … When ssh’d into a remote Unix machine from a Mac, it doesn’t me. I don’t think I’ve tried locally.

            • toynbee@lemmy.world
              link
              fedilink
              arrow-up
              1
              ·
              2 months ago

              Just as a matter of interest, I just tried this and it simply printed ≤ on the console. I’m using Terminal and Tahoe 26.2.

              • softwarist@programming.dev
                link
                fedilink
                English
                arrow-up
                2
                ·
                2 months ago

                I think for Terminal.app you have to enable “Use Option as Meta key”

                • toynbee@lemmy.world
                  link
                  fedilink
                  arrow-up
                  2
                  ·
                  edit-2
                  2 months ago

                  I’ll try to remember to check it out in the morning, thank you.

                  edit: This worked. This is amazing. Thank you so much.

    • ttyybb@lemmy.world
      link
      fedilink
      arrow-up
      8
      ·
      2 months ago

      I don’t even want to think about how much effort this has saved me.

    • surewhynotlem@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      2 months ago

      Huh. And here I had aliased “history | grep” to hgrep and was using that.

    • Strider@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      2 months ago

      Also ‘cd -’ and aliases… 😁

    • /home/pineapplelover@lemmy.dbzer0.com
      link
      fedilink
      arrow-up
      1
      ·
      2 months ago

      And in fish

  • jikt@sh.itjust.works
    link
    fedilink
    arrow-up
    9
    ·
    2 months ago

    history | grep 'ls -la' | sed 's/^[[:space:]]*[0-9]\+[[:space:]]*//' | sh

  • ramenshaman@lemmy.world
    link
    fedilink
    arrow-up
    8
    ·
    2 months ago

    $ sudo apt install sl

    Try sl instead of ls, you’ll thank me later

  • pedz@lemmy.ca
    link
    fedilink
    arrow-up
    8
    ·
    2 months ago

    To be even more efficient while being lazy, try oh-my-bash. You can start typing the beginning of a command and use arrow up to cycle through only those, instead of the whole history. So if you had a very long mount command and don’t want to type it again, type mount and up arrow until it can be found. Not very useful for ls -al but very appreciated on longer commands.

    • chellomere@lemmy.world
      link
      fedilink
      arrow-up
      8
      ·
      2 months ago

      I personally use fzf to do basically the same thing, I just have to press ctrl-r before I start to type, and it does fuzzy matching to your history and shows more than one alternative at a time

  • irelephant [he/him]@lemmy.dbzer0.com
    link
    fedilink
    arrow-up
    7
    ·
    2 months ago

    cd - will bring you to the last directory you were in.

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

    I just alias ls -lah to lsl.

    • ratel@mander.xyz
      link
      fedilink
      arrow-up
      4
      ·
      2 months ago

      Yeah lk = ls -larth for me because lk is right next to each other.

  • FauxLiving@lemmy.world
    link
    fedilink
    arrow-up
    4
    ·
    2 months ago

    ls, ctrl+R

    Significantly less up arrows

  • Zink@programming.dev
    link
    fedilink
    arrow-up
    4
    ·
    2 months ago

    I leave ls alone and instead do

    alias l='ls -latrF'
    

    I do sometimes just want to use the plain version, especially if I’m in a small terminal window for some reason. But I think my brain likes scanning 1D lists more than 2D grids, no matter whether I’m in a terminal or using a graphical file manager.

    • raspberriesareyummy@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      2 months ago

      Plain version is the one to pipe output for further processing. ls | wc -l

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

    People talking about history without mentioning the laziest answer is to use an alias, which bash usually has ll = la -la or my personal preference is ll = ls -lAh (list + Everything except . and .. + human readable file size)

linuxmemes@lemmy.world

linuxmemes@lemmy.world

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: !linuxmemes@lemmy.world

Hint: :q!


Sister communities:
  • !tech_memes@lemmy.world
  • !memes@lemmy.world
  • !lemmyshitpost@lemmy.world
  • !risa@startrek.website

Community rules (click to expand)

1. Follow the site-wide rules
  • Instance-wide TOS: https://legal.lemmy.world/tos/
  • Lemmy code of conduct: https://join-lemmy.org/docs/code_of_conduct.html
2. Be civil
  • Understand the difference between a joke and an insult.
  • Do not harrass or attack users for any reason. This includes using blanket terms, like “every user of thing”.
  • Don’t get baited into back-and-forth insults. We are not animals.
  • Leave remarks of “peasantry” to the PCMR community. If you dislike an OS/service/application, attack the thing you dislike, not the individuals who use it. Some people may not have a choice.
  • Bigotry will not be tolerated.
3. Post Linux-related content
  • Including Unix and BSD.
  • Non-Linux content is acceptable as long as it makes a reference to Linux. For example, the poorly made mockery of sudo in Windows.
  • No porn, no politics, no trolling or ragebaiting.
  • Don’t come looking for advice, this is not the right community.
4. No recent reposts
  • Everybody uses Arch btw, can’t quit Vim, <loves/tolerates/hates> systemd, and wants to interject for a moment. You can stop now.
5. 🇬🇧 Language/язык/Sprache
  • This is primarily an English-speaking community. 🇬🇧🇦🇺🇺🇸
  • Comments written in other languages are allowed.
  • The substance of a post should be comprehensible for people who only speak English.
  • Titles and post bodies written in other languages will be allowed, but only as long as the above rule is observed.
6. (NEW!) Regarding public figures

We all have our opinions, and certain public figures can be divisive. Keep in mind that this is a community for memes and light-hearted fun, not for airing grievances or leveling accusations.

  • Keep discussions polite and free of disparagement.
  • We are never in possession of all of the facts. Defamatory comments will not be tolerated.
  • Discussions that get too heated will be locked and offending comments removed.

 

Please report posts and comments that break these rules!


Important: never execute code or follow advice that you don’t understand or can’t verify, especially here. The word of the day is credibility. This is a meme community – even the most helpful comments might just be shitposts that can damage your system. Be aware, be smart, don’t remove France.

Visibility: Public
globe

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

  • 1.52K users / day
  • 4.62K users / week
  • 7.21K users / month
  • 11.9K users / 6 months
  • 1 local subscriber
  • 30.7K subscribers
  • 1.12K Posts
  • 12.8K Comments
  • Modlog
  • mods:
  • zephyr@lemmy.world
  • rtxn@lemmy.world
  • BE: 0.19.16
  • Modlog
  • Legal
  • Instances
  • Docs
  • Code
  • join-lemmy.org