ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Ubuntu: history -c doesn't clear

    IT Discussion
    ubuntu ubuntu 18.04 ubuntu 18.10 history history -c
    3
    7
    658
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • gjacobseG
      gjacobse
      last edited by

      Weirdly - even before upgrading to 18.10, history -c wasn't clearing the list.

      Now, even 18.10 history -c still does not clear the history.

      Emad RE 1 Reply Last reply Reply Quote 0
      • scottalanmillerS
        scottalanmiller
        last edited by

        Chances are you have another terminal open. history -c clears the file out, but any open BASH session will immediately repopulate it with the in memory history cache.

        gjacobseG 1 Reply Last reply Reply Quote 0
        • gjacobseG
          gjacobse @scottalanmiller
          last edited by

          @scottalanmiller said in Ubuntu: history -c doesn't clear:

          Chances are you have another terminal open. history -c clears the file out, but any open BASH session will immediately repopulate it with the in memory history cache.

          I wondered that a few months ago,.. how did the commands in one term list when more than one was open... it joins it.

          This is with just one term window is open and even after a reboot.

          1 Reply Last reply Reply Quote 0
          • scottalanmillerS
            scottalanmiller
            last edited by

            Try this instead...

            history -c; history -w
            
            gjacobseG 1 Reply Last reply Reply Quote 2
            • Emad RE
              Emad R @gjacobse
              last edited by

              @gjacobse

              you can disable history all together if you want,

              https://www.cyberciti.biz/faq/disable-bash-shell-history-linux/

              gjacobseG 1 Reply Last reply Reply Quote 0
              • gjacobseG
                gjacobse @scottalanmiller
                last edited by

                @scottalanmiller said in Ubuntu: history -c doesn't clear:

                Try this instead...

                history -c; history -w
                

                That worked. Thank you.

                1 Reply Last reply Reply Quote 0
                • gjacobseG
                  gjacobse @Emad R
                  last edited by

                  @Emad-R said in Ubuntu: history -c doesn't clear:

                  @gjacobse

                  you can disable history all together if you want,

                  https://www.cyberciti.biz/faq/disable-bash-shell-history-linux/

                  Thank you, I have seen that. But I use history as a track of what I have installed and how I did it. I clear it periodically once I have exported it to a text file.

                  I do this also to share with my brother - as he's asked me how I've done something a number of times.

                  1 Reply Last reply Reply Quote 1
                  • 1 / 1
                  • First post
                    Last post