Switter.su
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
Carly™@lemmy.world to linuxmemes@lemmy.worldEnglish · 2 years ago

Look, I'm lazy, okay?

lemmy.world

message-square
87
fedilink
1.24K

Look, I'm lazy, okay?

lemmy.world

Carly™@lemmy.world to linuxmemes@lemmy.worldEnglish · 2 years ago
message-square
87
fedilink
alert-triangle
You must log in or register to comment.
  • HorreC@kbin.social
    link
    fedilink
    arrow-up
    54
    ·
    2 years ago

    control shift R, then start typing, it will search your bash history

    • LobsterDog@frig.social
      link
      fedilink
      arrow-up
      16
      arrow-down
      1
      ·
      2 years ago

      Is it not just Ctrl-R or is that platform dependent

      • count_duckula@discuss.tchncs.de
        link
        fedilink
        English
        arrow-up
        6
        ·
        2 years ago

        I have always used ctrl-r but I just checked and both work. TIL.

        • tsukassa@lemmynsfw.com
          link
          fedilink
          English
          arrow-up
          3
          ·
          2 years ago

          Thanks for clearing up this mystery.

    • mrmanager@lemmy.today
      link
      fedilink
      arrow-up
      12
      ·
      2 years ago

      Hmm, normally it’s just ctrl - r… Are you sure the shift is needed on your system?

      • lungdart@lemmy.ca
        link
        fedilink
        arrow-up
        3
        ·
        2 years ago

        Don’t forget fzf. That will really jazz up your history search!

        • mausy5043@lemmy.world
          link
          fedilink
          arrow-up
          1
          ·
          2 years ago

          No man entry for fzf

          • lungdart@lemmy.ca
            link
            fedilink
            arrow-up
            1
            ·
            2 years ago

            https://github.com/junegunn/fzf

            I recommend installing it as an oh-my-zsh plugin, but it’s not hard to get running in vanilla zsh/bash

          • mrmanager@lemmy.today
            link
            fedilink
            arrow-up
            2
            arrow-down
            1
            ·
            2 years ago

            Ok if you want to learn Linux, you need to start web searching for stuff you hear about. :)

      • HorreC@kbin.social
        link
        fedilink
        arrow-up
        2
        ·
        2 years ago

        you are right, I must have just learned it with a shift for some dumb reason and it stuck, thank you internet person.

      • med@sh.itjust.works
        link
        fedilink
        arrow-up
        1
        ·
        2 years ago

        Some variants have ctrl+r bound to something else

    • whofearsthenight@kbin.social
      link
      fedilink
      arrow-up
      7
      ·
      2 years ago

      Now if you had to guess how often I remember that there is a keyboard shortcut that does this, but don’t remember what it is, and do remember that I can just press up 30-70 times…

      • HorreC@kbin.social
        link
        fedilink
        arrow-up
        3
        ·
        2 years ago

        you can hit it again after you are dialed in as much as you want and it will keep going back in time with the words you have in there and stuff that matches!

    • Rikudou_Sage@lemmings.world
      link
      fedilink
      arrow-up
      5
      ·
      2 years ago

      I recommend using mcfly for that, it makes it even better.

    • fuckstick@lemmy.world
      link
      fedilink
      English
      arrow-up
      4
      ·
      2 years ago

      This. It took a while for it to sink in but now it’s muscle memory and a huge time saver

      • Bipta@kbin.social
        link
        fedilink
        arrow-up
        3
        ·
        edit-2
        2 years ago

        What now? What is r? How does this work?

        • fuckstick@lemmy.world
          link
          fedilink
          English
          arrow-up
          6
          ·
          2 years ago

          CTRL+R brings up a prompt and allows you to search through commands you’ve run before. If you’ve run different variations of the command hitting CTRL+R or CTRL+SHIFT+R cycles through commands similar to what you’ve typed out.

          • gaiussabinus@lemmy.world
            link
            fedilink
            English
            arrow-up
            8
            ·
            2 years ago

            I’m new to linux and i’ve been using $history | grep <thingy>. This information is very useful, thank you.

            • fuckstick@lemmy.world
              link
              fedilink
              English
              arrow-up
              4
              ·
              2 years ago

              Sure thing! There’s lots of ways to do the same things, but either way stops you from hitting the up key a bajillion times

    • DontRedditMyLemmy@lemmy.world
      link
      fedilink
      arrow-up
      3
      ·
      2 years ago

      Why r? Maybe if I knew why r, then I wouldn’t forget this every 13 seconds…

      • danielton@lemmy.world
        link
        fedilink
        English
        arrow-up
        10
        ·
        2 years ago

        Reverse search

  • m15otw@feddit.uk
    link
    fedilink
    English
    arrow-up
    50
    ·
    2 years ago

    Ctrl+R

    Then type any part of the command (filename, search string, etc)

    Ctrl+R again to cycle through the matches.

    (Best feature in bash)

    • p0q@sh.itjust.works
      link
      fedilink
      English
      arrow-up
      11
      ·
      2 years ago

      Use fzf for a more visual search.

      • LeanFemurs@lemmy.world
        link
        fedilink
        English
        arrow-up
        5
        ·
        2 years ago

        This is the way.

    • brakenium@lemm.ee
      link
      fedilink
      English
      arrow-up
      8
      ·
      2 years ago

      I’ve been using this for a long time, never knew I could press Ctrl + R again. Thanks!

      • wandering_nomad@lemmy.world
        link
        fedilink
        English
        arrow-up
        8
        ·
        2 years ago

        Ctrl + S to go the other way if you overshoot!

    • spoopyking@lemmy.fmhy.ml
      link
      fedilink
      English
      arrow-up
      6
      ·
      2 years ago

      Or history | grep 'command'

      • m15otw@feddit.uk
        link
        fedilink
        English
        arrow-up
        3
        ·
        2 years ago

        Can’t just hit enter to run the one you want then, though.

        • rufus@lemmy.world
          link
          fedilink
          English
          arrow-up
          7
          ·
          2 years ago

          Type: !1234 … to run whatever history number of the command.

    • LucidDaemon@lemmy.world
      link
      fedilink
      English
      arrow-up
      1
      ·
      2 years ago

      Wish I knew this sooner.

    • Sorse@discuss.tchncs.de
      link
      fedilink
      arrow-up
      1
      ·
      3 months ago

      Also works in fish

    • Sidewayspeach@feddit.nl
      link
      fedilink
      English
      arrow-up
      1
      ·
      2 years ago

      But how to go backwards and forwards through the results? I just cycle through again!!

      • m15otw@feddit.uk
        link
        fedilink
        English
        arrow-up
        1
        ·
        2 years ago

        As @wandering_nomad@lemmy.world said above, Ctrl+S

  • runswithjedi@lemmy.world
    link
    fedilink
    English
    arrow-up
    12
    ·
    2 years ago

    deleted by creator

    • Skyler@kbin.social
      link
      fedilink
      arrow-up
      7
      ·
      2 years ago

      This is my approach, and for those who don’t know, you can use those line numbers that come back from history to rerun the command. Like if your output is something like this:

      $ history | grep tmp
        501  ls /tmp
        502  history | grep tmp
      
      

      You can run !501 and it will just re-run ls /tmp

      • IthronMorn@sh.itjust.works
        link
        fedilink
        arrow-up
        1
        ·
        2 years ago

        Woah! I had no clue!

    • bustrpoindextr@lemmy.world
      link
      fedilink
      English
      arrow-up
      6
      ·
      2 years ago

      I got that as hgrep

      • runswithjedi@lemmy.world
        link
        fedilink
        English
        arrow-up
        2
        ·
        2 years ago

        deleted by creator

    • pleb@discuss.tchncs.de
      link
      fedilink
      English
      arrow-up
      6
      ·
      2 years ago

      Yall are missing out on autocomplete.

      • runswithjedi@lemmy.world
        link
        fedilink
        English
        arrow-up
        2
        ·
        2 years ago

        deleted by creator

    • notasandwich1948@sh.itjust.works
      link
      fedilink
      English
      arrow-up
      3
      ·
      2 years ago

      didn’t know there was a comment for that, I just always used cat to read the bash history file

      • mrmanager@lemmy.today
        link
        fedilink
        English
        arrow-up
        2
        ·
        edit-2
        2 years ago

        Wait until you learn about ctrl-R to search the bash history… :) If you press that and start typing, you will get auto complete from previous commands you typed. This is how an experienced linux user can be so fast in the terminal.

        There are even better tools for this, so ctrl R is just the built in way. Later you should look into https://github.com/junegunn/fzf

      • runswithjedi@lemmy.world
        link
        fedilink
        English
        arrow-up
        1
        ·
        2 years ago

        deleted by creator

  • skomposzczet@vlemmy.net
    link
    fedilink
    English
    arrow-up
    10
    ·
    2 years ago

    up, up, up, up, up, cd …, ah there it is.

  • vimdiesel@lemmy.world
    link
    fedilink
    English
    arrow-up
    10
    ·
    2 years ago

    ⬆️ ⬆️ ⬆️ ⬆️ ⬆️ ⬆️ ⬆️ ⬆️ ⬆️ ⬆️ ⬆️ ⬆️ ⬆️ ⬆️ ⬆️ ⬆️ ⬆️ ⬆️ ⬆️ ⬆️ ⬆️ ⬆️ ⬆️ ⬆️ ⬆️ ⬆️ ⬆️ ⬇️ ⬇️

  • rocket@wirebase.org
    link
    fedilink
    English
    arrow-up
    10
    ·
    2 years ago

    ^r ftw

  • tobier@lemmy.world
    link
    fedilink
    English
    arrow-up
    10
    ·
    2 years ago

    This is why I switched to fish; it seems to be much smarter understanding what I want to type.

    • amos@lemmy.world
      link
      fedilink
      English
      arrow-up
      7
      ·
      2 years ago

      Yeah it’s great how ctrl-r is kinda the default instead of something you have to go out of your way to use. Just start typing a command and the up arrow will only cycle through history that matches what you’ve typed so far.

      • sneeple@reddthat.com
        link
        fedilink
        English
        arrow-up
        2
        ·
        2 years ago

        Idk exactly what plugin it is, but zsh + oh my zsh has exactly this same thing. So hard to live without now that I’m used to it. Probably my favorite feature

        • notavote@lemmy.world
          link
          fedilink
          English
          arrow-up
          2
          ·
          2 years ago

          That is default zsh history search, pretty nice.

          • sneeple@reddthat.com
            link
            fedilink
            English
            arrow-up
            1
            ·
            2 years ago

            Oh is it just a setting then? I remember using plain zsh and it didn’t have that functionality until I installed omz, but I could see it being an option that omz enables on install.

            • notavote@lemmy.world
              link
              fedilink
              English
              arrow-up
              1
              ·
              2 years ago

              I think that it is.

    • amos@lemmy.world
      link
      fedilink
      English
      arrow-up
      1
      arrow-down
      1
      ·
      2 years ago

      Yeah it’s great how ctrl-r is kinda the default instead of something you have to go out of your way to use. Just start typing a command and the up arrow will only cycle through history that matches what you’ve typed so far.

    • amos@lemmy.world
      link
      fedilink
      English
      arrow-up
      1
      arrow-down
      1
      ·
      2 years ago

      Yeah it’s great how ctrl-r is kinda the default instead of something you have to go out of your way to use. Just start typing a command and the up arrow will only cycle through history that matches what you’ve typed so far.

  • ttk@feddit.de
    link
    fedilink
    English
    arrow-up
    10
    ·
    2 years ago

    fzf masterrace

  • Aceticon@lemmy.world
    link
    fedilink
    English
    arrow-up
    8
    ·
    2 years ago

    It’s like the bus-stop-paradigm: If I wait just a bit longer and it will come. Meanwhile it would’ve been faster to walk.

  • Badland9085@lemm.ee
    link
    fedilink
    English
    arrow-up
    7
    ·
    2 years ago

    To anyone who uses vim mode, ? lets you search through your stored command history, from normal mode ofc.

  • Ignacio@kbin.social
    link
    fedilink
    arrow-up
    7
    ·
    2 years ago

    It’s even faster if you look for it inside .bash_history.

    • Teeetris@feddit.nl
      link
      fedilink
      arrow-up
      2
      ·
      2 years ago

      Still noup

  • Sketchpad01@lemmy.world
    link
    fedilink
    English
    arrow-up
    7
    ·
    2 years ago

    Using the history command just to find the specific IP I need to ssh to

    • driving_crooner@lemmy.eco.br
      link
      fedilink
      English
      arrow-up
      1
      ·
      edit-2
      2 years ago

      More like to find ping -O 8.8.8.8

  • Astaroth@lemmy.world
    link
    fedilink
    English
    arrow-up
    6
    ·
    edit-2
    2 years ago

    deleted by creator

    • pleb@discuss.tchncs.de
      link
      fedilink
      English
      arrow-up
      2
      ·
      edit-2
      2 years ago

      Same. Look at all these people using grep to search their history.

  • Konata@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    5
    ·
    2 years ago

    “python3 -m http.server”

  • Socsa@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    5
    ·
    2 years ago

    We will history | grep docker until morale improves

    • JasonDJ@vlemmy.net
      link
      fedilink
      English
      arrow-up
      4
      ·
      edit-2
      2 years ago

      Gah it’s all docker container ps -a. OK, fine, history | grep "docker run".

      Next time I’ll put a file in the project directory that tells me how I ran it and .gitignore it. I promise. Next time.

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.
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.33K users / day
  • 3.54K users / week
  • 9.66K users / month
  • 17.9K users / 6 months
  • 1 local subscriber
  • 25K subscribers
  • 1.63K Posts
  • 89K Comments
  • Modlog
  • mods:
  • Kevin@lemmy.world
  • zephyr@lemmy.world
  • rtxn@lemmy.world
  • BE: 0.19.10
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org