Delete history from 100 to 150 entries in bash shell

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I want to delete history but not fully, suppose I have total 200 entries in my history and I want to delete from 101 to 150. Is this possible ?



I have seen multiple methods to delete history like history -d entry_number, .bash_history file, history -c command.










share|improve this question















migrated from stackoverflow.com Nov 30 at 6:54


This question came from our site for professional and enthusiast programmers.


















    up vote
    0
    down vote

    favorite












    I want to delete history but not fully, suppose I have total 200 entries in my history and I want to delete from 101 to 150. Is this possible ?



    I have seen multiple methods to delete history like history -d entry_number, .bash_history file, history -c command.










    share|improve this question















    migrated from stackoverflow.com Nov 30 at 6:54


    This question came from our site for professional and enthusiast programmers.
















      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I want to delete history but not fully, suppose I have total 200 entries in my history and I want to delete from 101 to 150. Is this possible ?



      I have seen multiple methods to delete history like history -d entry_number, .bash_history file, history -c command.










      share|improve this question















      I want to delete history but not fully, suppose I have total 200 entries in my history and I want to delete from 101 to 150. Is this possible ?



      I have seen multiple methods to delete history like history -d entry_number, .bash_history file, history -c command.







      bash command-history






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 30 at 10:41









      Jeff Schaller

      37.4k1052121




      37.4k1052121










      asked Nov 30 at 5:38







      Dhankhar











      migrated from stackoverflow.com Nov 30 at 6:54


      This question came from our site for professional and enthusiast programmers.






      migrated from stackoverflow.com Nov 30 at 6:54


      This question came from our site for professional and enthusiast programmers.






















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          3
          down vote













          You can try this



          for i in 1..50
          do
          history -d 101
          done


          This will delete history number 101 50 times or each time it deletes history number 101 next time 102 will become 101.






          share|improve this answer





























            up vote
            -1
            down vote













            If you have vim you can do:



            vim -c "101,150d | wq" your_file





            share|improve this answer




















              Your Answer








              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "106"
              ;
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function()
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled)
              StackExchange.using("snippets", function()
              createEditor();
              );

              else
              createEditor();

              );

              function createEditor()
              StackExchange.prepareEditor(
              heartbeatType: 'answer',
              convertImagesToLinks: false,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              imageUploader:
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              ,
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );













              draft saved

              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f485081%2fdelete-history-from-100-to-150-entries-in-bash-shell%23new-answer', 'question_page');

              );

              Post as a guest















              Required, but never shown
























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes








              up vote
              3
              down vote













              You can try this



              for i in 1..50
              do
              history -d 101
              done


              This will delete history number 101 50 times or each time it deletes history number 101 next time 102 will become 101.






              share|improve this answer


























                up vote
                3
                down vote













                You can try this



                for i in 1..50
                do
                history -d 101
                done


                This will delete history number 101 50 times or each time it deletes history number 101 next time 102 will become 101.






                share|improve this answer
























                  up vote
                  3
                  down vote










                  up vote
                  3
                  down vote









                  You can try this



                  for i in 1..50
                  do
                  history -d 101
                  done


                  This will delete history number 101 50 times or each time it deletes history number 101 next time 102 will become 101.






                  share|improve this answer














                  You can try this



                  for i in 1..50
                  do
                  history -d 101
                  done


                  This will delete history number 101 50 times or each time it deletes history number 101 next time 102 will become 101.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Nov 30 at 14:47

























                  answered Nov 30 at 8:25









                  Debian_yadav

                  1,3583922




                  1,3583922






















                      up vote
                      -1
                      down vote













                      If you have vim you can do:



                      vim -c "101,150d | wq" your_file





                      share|improve this answer
























                        up vote
                        -1
                        down vote













                        If you have vim you can do:



                        vim -c "101,150d | wq" your_file





                        share|improve this answer






















                          up vote
                          -1
                          down vote










                          up vote
                          -1
                          down vote









                          If you have vim you can do:



                          vim -c "101,150d | wq" your_file





                          share|improve this answer












                          If you have vim you can do:



                          vim -c "101,150d | wq" your_file






                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Nov 30 at 12:16









                          Shadowchaser

                          11




                          11



























                              draft saved

                              draft discarded
















































                              Thanks for contributing an answer to Unix & Linux Stack Exchange!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid


                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.

                              To learn more, see our tips on writing great answers.





                              Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                              Please pay close attention to the following guidance:


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid


                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.

                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f485081%2fdelete-history-from-100-to-150-entries-in-bash-shell%23new-answer', 'question_page');

                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown






                              Popular posts from this blog

                              How to check contact read email or not when send email to Individual?

                              Bahrain

                              Postfix configuration issue with fips on centos 7; mailgun relay