I want to control and use command line history better

Forum Forums General Tips and Tricks I want to control and use command line history better

  • This topic has 36 replies, 6 voices, and was last updated Mar 15-8:35 pm by Brian Masinick.
Viewing 15 posts - 16 through 30 (of 37 total)
  • Author
    Posts
  • #55007
    Moderator
    Brian Masinick
      Helpful
      Up
      0
      ::

      I know that the hstr tool is handy.

      There’s a lot you can do with shell history.

      • This reply was modified 2 years, 2 months ago by Brian Masinick.

      --
      Brian Masinick

      #55014
      Moderator
      Brian Masinick
        Helpful
        Up
        0
        ::

        hstr

        HSTR is a command line utility that brings improved BASH command completion from the history.
        It aims to make completion easier and more efficient than Ctrl-r.

        view, navigate, search, and use your command history
        In addition to completion, hstr enables you to manage your history list.
        You can bookmark your favorite commands, and can remove commandstrings
        that were mistakes, or are now obsolete, or contain sensitive//password details.

        It will be available in debian bullseye https://packages.debian.org/search?keywords=hstr&searchon=names&suite=all&section=all
        In the meantime, you can

        cd /tmp
        git clone https://github.com/dvorka/hstr
        sudo apt install autotools-dev libreadline-dev libncursesw5-dev
        cd /tmp/hstr
        cd ./build/tarball && ./tarball-automake.sh && cd ../..

        #./configure && make
        /tmp/hstr/src/hstr

        ### OR

        #./configure && make && make install
        hstr

        I was able to download the hstr program with git, then run the sudo apt install autotools-dev libreadline-dev libncursesw5-dev and cd /tmp/hstr, but the steps after that fail, specifically running configure and then make. The configure step generates the following errors:

        $ cd ./build/tarball && ./tarball-automake.sh && cd ../..
        ./tarball-automake.sh: line 21: automake: command not found
        ./tarball-automake.sh: line 39: aclocal: command not found
        ./tarball-automake.sh: line 40: automake: command not found
        ./tarball-automake.sh: line 41: autoconf: command not found
        cp: cannot stat '/compile': No such file or directory
        cp: cannot stat '/depcomp': No such file or directory
        cp: cannot stat '/install-sh': No such file or directory
        cp: cannot stat '/missing': No such file or directory
        cp: cannot stat '/config.sub': No such file or directory
        cp: cannot stat '/config.guess': No such file or directory
        DONE: ./tarball-automake.sh finished in /tmp/hstr
        • This reply was modified 2 years, 2 months ago by Brian Masinick.

        --
        Brian Masinick

        #55016
        Moderator
        Brian Masinick
          Helpful
          Up
          0
          ::

          I did, however, enable the buster repos and then I was able to apt install hstr without issues.

          --
          Brian Masinick

          #55017
          Moderator
          BobC
            Helpful
            Up
            0
            ::

            Brian, It looks like automake isn’t installed.

            I think we should ask anticapitalista to include hstr in antiX 21 and assign it to a key like ctrl-r?

            #55018
            Moderator
            Brian Masinick
              Helpful
              Up
              0
              ::

              I found the hstr package in Bullseye. If there is also a hstr package in the other repos, maybe it’ll still work.

              --
              Brian Masinick

              #55019
              Moderator
              Brian Masinick
                Helpful
                Up
                0
                ::

                After installing hstr, I typed hstr as a command from a terminal and it provides the history directly; all you have to do is scroll through it until you find the command you want, then press it, If you decide not to run any commands, you can type Ctrl-G to exit.

                Though you can do similar things with Bash history if you use Emacs key bindings and the C-r (Ctrl-R) key, or type history to view history, and then type ! followed by the number of the command you want to run again, without a doubt hstr is easier. Also, if you have vi key bindings in Bash, you can use vi commands to go back and edit the history, so both Emacs and vi key bindings allow editing, but only if you understand those editors; hstr makes command editing easier.

                --
                Brian Masinick

                #55024
                Moderator
                BobC
                  Helpful
                  Up
                  0
                  ::

                  Brian, It’s not in the 19.3 repos. I could zip my hstr built for 19.3 64 bit and post it here, on the web, or email it to you?

                  #55025
                  Moderator
                  Brian Masinick
                    Helpful
                    Up
                    0
                    ::

                    Brian, It’s not in the 19.3 repos. I could zip my hstr built for 19.3 64 bit and post it here, on the web, or email it to you?

                    I already have hstr installed on the antiX 21 Alpha build, which has Debian Bullseye enabled.

                    I can check the other antiX builds, but since I know that I can get it from Bullseye, it’s not a problem for me. I’ve already tried hstr and it works.

                    --
                    Brian Masinick

                    #55026
                    Moderator
                    Brian Masinick
                      Helpful
                      Up
                      0
                      ::

                      hstr is NOT included in Buster; just confirmed; it IS in Bullseye. So you can get it easily if you either add a Bullseye Debian repo OR you simply try the current antiX 21 test builds. I’ve found both to work fine with no serious issues, but your mileage may vary.

                      --
                      Brian Masinick

                      #55033
                      Anonymous
                        Helpful
                        Up
                        0
                        ::

                        include hstr in antiX 21 and assign it to a key like ctrl-r?

                        Instead, just moving this topic into “tip-n-tricks” might be a better choice.

                        consider:
                        Disturbing the default (bash) Ctrl+r behavior would be “surprising” and would be regarded by some users as unwelcome. Some would prefer to stick with emacs-mode behavior, others vi-mode… and many among the younger crowd seem to favor fvf over hstr. A further cadre are averse to interacting via a “shell prompt”, period, and would instead use the history search|maintain|bookmark functionality provided by a “finder” utility, e.g. kupfer or rofi.

                        Your enthusiasm toward hstr, and your suggestion… reminds me of mine, toward ncdu. In retrospect, although I’m glad it became preinstalled in antiX, I do suspect that for most people who might use it, it just “sits” as an undiscovered gem. In the absence of a highly-detailed “User Manual” (which no one ever finds the time to draft) (and maintain editions in umpteen languages?), suitably interested potential users might as well just discover via blogs//articles (example: the ncdu article linked a few lines back, it contains screenshots) and install-on-demand. Heh, mentioning this reminded me: https://www.antixforum.com/forums/topic/project-gather-helpdoc-links-for-preinstalled-antix-programs/ and https://www.antixforum.com/forums/topic/additional-candidates-for-antix-cli-suggested-list/

                        You asked about search strategy, but I don’t have any to suggest in this case b/c I did not search when replying. I had probably discovered hstr while browsing one of the manymany sites I trawl

                        Topic: where do YOU learn about additional apps/software? http://forum.mxlinux.org/viewtopic.php?f=101&t=41612
                        Topic: favorite linux-n-opensource NEWS sites (and RSS feeds) http://forum.mxlinux.org/viewtopic.php?f=101&t=41613

                        …ah, no, hold on… in this case, I had visited the project site for (the wonderfully over-engineered) mindforger project and clicked the mindforger author’s github page https://github.com/dvorka to see what other projects were on the plate of that evil genius.

                        #55034
                        Moderator
                        Brian Masinick
                          Helpful
                          Up
                          0
                          ::

                          I don’t want to replace C-r behavior either; I use it often. I also use history. I do think that hstr will be useful for some people but it’s not a must have. I’ve been doing fine without it for 40 years.

                          I have my own accelerators and other mechanisms that I can use with other tools. Various techniques also keep my hands from same motion fatigue.

                          • This reply was modified 2 years, 2 months ago by Brian Masinick.
                          • This reply was modified 2 years, 2 months ago by Brian Masinick.

                          --
                          Brian Masinick

                          #55037
                          Moderator
                          BobC
                            Helpful
                            Up
                            0
                            ::

                            Ok, I’ll admit to being old and slow at adjusting. I’m always looking for better tools to get thinks done quicker and more reliably, and if I can find one that helps me, I’ll try it.

                            I only suggested the Ctrl-r because that’s what I read. I code all day, support multiple systems at night and weekends, and my brain just wants to use the keys it knows to do the things it expects them to do, and I am very grateful for every program that either makes rational choices in the first place or better yet, allows me to easily customize them.

                            I really think we’ve found another *Gem* 🙂

                            Do we need a help text for ncdu? Where would it go? Maybe I could write it in a similar style as what’s already there… In English, I’m afraid, but there must be a kind soul for each other language out there as well…

                            #55052
                            Moderator
                            BobC
                              Helpful
                              Up
                              0
                              ::

                              Ok, guys, but we need to assign it to a hotkey, or it will never be found. Please make rational suggestions…

                              #55071
                              Moderator
                              Brian Masinick
                                Helpful
                                Up
                                0
                                ::

                                Ok, guys, but we need to assign it to a hotkey, or it will never be found. Please make rational suggestions…

                                Assign it to a function key, maybe F5 or DO or something else but don’t replace existing Ctrl-r or anything already assigned by the shell itself because that changes standard capabilities.

                                --
                                Brian Masinick

                                #55077
                                Anonymous
                                  Helpful
                                  Up
                                  0
                                  ::

                                  Is the

                                  super + r

                                  aka the windows key being used for other anything?

                                Viewing 15 posts - 16 through 30 (of 37 total)
                                • You must be logged in to reply to this topic.