ubergeek77's Lemmy
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
not_IO@lemmy.blahaj.zone to linuxmemes@lemmy.worldEnglish · 19 hours ago

after every cd

media.mas.to

message-square
46
fedilink
792

after every cd

media.mas.to

not_IO@lemmy.blahaj.zone to linuxmemes@lemmy.worldEnglish · 19 hours ago
message-square
46
fedilink

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

alert-triangle
You must log in or # to comment.
  • jikt@sh.itjust.works
    link
    fedilink
    arrow-up
    9
    ·
    9 hours ago

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

  • lmmarsano@lemmynsfw.com
    link
    fedilink
    English
    arrow-up
    4
    ·
    edit-2
    9 hours ago

    Reposted yet again.
    meme: bitches dont know bout ctrl-r
    As usual, the documentation covers these answers plus much more.

    • Bash command line editing covers searching.
    • Readline library command line editing covers searching.
  • wildbus8979@sh.itjust.works
    link
    fedilink
    arrow-up
    71
    ·
    19 hours 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
      33
      ·
      19 hours 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
        15
        ·
        19 hours 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
          7
          arrow-down
          1
          ·
          17 hours 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
            ·
            13 hours ago

            ⌥+. does the trick for me on MacOS.

            • 𝄞 Inkstain (they/them)𓆩 𓆪@pawb.social
              link
              fedilink
              arrow-up
              1
              ·
              7 hours ago

              Wow, that’s a new Unicode symbol

            • toynbee@lemmy.world
              link
              fedilink
              arrow-up
              2
              ·
              12 hours 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.

    • ttyybb@lemmy.world
      link
      fedilink
      arrow-up
      9
      ·
      19 hours ago

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

    • ScientifficDoggo@lemmy.zip
      link
      fedilink
      English
      arrow-up
      7
      ·
      19 hours ago

      Yeesh, I just learned something new. Thanks!

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

      And in fish

    • Syndication@lemmy.today
      link
      fedilink
      arrow-up
      3
      ·
      19 hours ago

      I was just about to ask how the hell anyone remembers or knows all these commands, thanks for the info! I am trying to learn Linux and get used to using the Terminal more often.

      • wildbus8979@sh.itjust.works
        link
        fedilink
        arrow-up
        3
        ·
        17 hours ago

        You can also just grep through your .bash_history

    • Aussieiuszko@aussie.zone
      link
      fedilink
      arrow-up
      2
      ·
      18 hours ago

      Neat

    • surewhynotlem@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      18 hours ago

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

  • ramenshaman@lemmy.world
    link
    fedilink
    arrow-up
    9
    ·
    edit-2
    14 hours ago

    $ sudo apt install sl

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

  • pinball_wizard@lemmy.zip
    link
    fedilink
    arrow-up
    25
    ·
    18 hours ago

    This thread is full of great solutions that I know I will ignore…

  • Anafabula@discuss.tchncs.de
    link
    fedilink
    arrow-up
    14
    ·
    17 hours ago

    I also recommend Atuin, the better shell history that works with most shells and can replace both up arrow and ctrl-r

    • Wildmimic@anarchist.nexus
      link
      fedilink
      English
      arrow-up
      2
      ·
      8 hours ago

      Thanks for that, thats much more comfortable!

  • nil@piefed.ca
    link
    fedilink
    English
    arrow-up
    1
    ·
    9 hours ago

    is yazi allowed?

  • FauxLiving@lemmy.world
    link
    fedilink
    arrow-up
    6
    ·
    15 hours ago

    ls, ctrl+R

    Significantly less up arrows

  • bdonvr@thelemmy.club
    link
    fedilink
    arrow-up
    22
    ·
    19 hours ago

    Ctrl-R

    Try it. Please, I beg you.

  • Ada@piefed.blahaj.zone
    link
    fedilink
    English
    arrow-up
    15
    ·
    19 hours ago

    In addition to ctrl-r, there is also fish! Fish does something similar to Ctrl-R, but in an easier to use way. Start typing a command, and then press the up arrow. It will cycle through your history, but only the history that includes the text you’ve started typing.

    • Undearius@lemmy.ca
      link
      fedilink
      English
      arrow-up
      11
      ·
      17 hours ago

      This can be enabled in bash by putting these two lines in ~/.inputrc

      "\e[A": history-search-backward
      "\e[B": history-search-forward
      
      • Wildmimic@anarchist.nexus
        link
        fedilink
        English
        arrow-up
        2
        ·
        8 hours ago

        My Nobara installation has those commands mapped to pageup/down by default, so it’s probably a default in other distros too if anyone wants to try it out without editing first

  • AItoothbrush@lemmy.zip
    link
    fedilink
    English
    arrow-up
    10
    ·
    18 hours ago

    Very useful tip: i have ls aliased to eza which is ls with eyecandy, I have la aliased to eza -a and I have cd aliased to cd && eza which makes navigating folders very easy. I also aliased … to cd … for convenience. I know a lot of people are purists about the terminal but i think this is a good ballance between convenience and simplicity. Doesnt do a lot of the cursed stuff ricers like to do.

    • Wildmimic@anarchist.nexus
      link
      fedilink
      English
      arrow-up
      2
      ·
      7 hours ago

      ooooh that’s nice! i love this threads, my shell gets soo much nicer! thank you all, you are great!

    • 𝄞 Inkstain (they/them)𓆩 𓆪@pawb.social
      link
      fedilink
      arrow-up
      1
      ·
      7 hours ago

      How do you have cd && eza setup? With an alias the arguments only get appended to the final command so how is it cding to the correct folder?

      • AItoothbrush@lemmy.zip
        link
        fedilink
        English
        arrow-up
        2
        ·
        6 hours ago

        I think i defined cd as a function for interactive shells or something. I dont remember and i dont have my computer so yeah. It should look something like this: cd() {builtin cd “$@” && eza}

    • Anafabula@discuss.tchncs.de
      link
      fedilink
      arrow-up
      10
      ·
      16 hours ago

      cd is a zoxide alias for me. If I need to navigate by folder content, I have yazi on y

      • AItoothbrush@lemmy.zip
        link
        fedilink
        English
        arrow-up
        3
        ·
        7 hours ago

        Yazi is nice but when im navigating shorter directory structures i prefer cd. Question of personal preference as all of this is.

    • DaforLynx@lemmy.zip
      link
      fedilink
      English
      arrow-up
      3
      ·
      17 hours ago

      Love convenient aliases. Would aliasing … cause “…/previous/file” to become " cd …/previous/file" and ruin some commands? I guess not. I also use eza :D

      • Prunebutt@slrpnk.net
        link
        fedilink
        arrow-up
        3
        ·
        17 hours ago

        Only if it’s a global alias, I think (those are useful for stuff like alias -g DN=/dev/null)

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

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

    • Electricd@lemmybefree.net
      link
      fedilink
      arrow-up
      2
      ·
      7 hours ago

      😮

  • pedz@lemmy.ca
    link
    fedilink
    arrow-up
    13
    ·
    19 hours 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
      ·
      18 hours 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

  • gandalf_der_12te@discuss.tchncs.de
    link
    fedilink
    arrow-up
    5
    ·
    edit-2
    16 hours ago

    ls -alh try that. -h means human-readable file sizes

  • Zink@programming.dev
    link
    fedilink
    arrow-up
    4
    ·
    16 hours 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
      ·
      15 hours ago

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

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: [email protected]

Hint: :q!


Sister communities:
  • [email protected]
  • [email protected]
  • [email protected]
  • [email protected]

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.

  • 2.4K users / day
  • 3.54K users / week
  • 7.99K users / month
  • 17K users / 6 months
  • 1 local subscriber
  • 29.1K subscribers
  • 2.03K Posts
  • 113K Comments
  • Modlog
  • mods:
  • Kevin@lemmy.world
  • zephyr@lemmy.world
  • rtxn@lemmy.world
  • BE: 0.19.7
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org