Results 1 to 10 of 11

Thread: Delete Terminal history?

Hybrid View

  1. #1
    Join Date
    Nov 2009
    Beans
    646

    Delete Terminal history?

    How do I easily and permanently delete the Terminal history (all of the stuff I've typed in Terminal)?

    Thanks

  2. #2
    Join Date
    Jun 2009
    Location
    0:0:0:0:0:0:0:1
    Beans
    4,697
    Distro
    Xubuntu

    Re: Delete Terminal history?

    [Alt]+[F2]
    Code:
    rm ~/.bash_history
    Laptop: ASUS A54C-NB91 (Storage: WD3200BEKT + MKNSSDCR60GB-DX); Desktop: Custom Build - Images included; rPi Server
    Putting your Networked Printer's scanner software to shame PHP Scanner Server
    I frequently edit my post when I have the last post

  3. #3
    Join Date
    Nov 2009
    Beans
    646

    Re: Delete Terminal history?

    I tried your commands but when I type "history" I still see all of the commands I've entered.

    Any ideas?

  4. #4
    Join Date
    Jun 2009
    Location
    0:0:0:0:0:0:0:1
    Beans
    4,697
    Distro
    Xubuntu

    Re: Delete Terminal history?

    if the terminal was open when you ran that that is expected, new windows should be empty
    if you run rm ~/.bash_history in a termnal and type exit yuor history will have exit and rm ~/.bash_history
    Laptop: ASUS A54C-NB91 (Storage: WD3200BEKT + MKNSSDCR60GB-DX); Desktop: Custom Build - Images included; rPi Server
    Putting your Networked Printer's scanner software to shame PHP Scanner Server
    I frequently edit my post when I have the last post

  5. #5
    Join Date
    Jan 2012
    Beans
    753

    Re: Delete Terminal history?

    Every time you exit a Terminal session, it saves the history to ~/.bash_history (that's to prevent multiple Terminal instances' history from interfering). So if you have a lot of history and then do "rm ~/.bash_history" but then you exit, everything you typed into the current session (including "rm ~/.bash_history") will be saved to a new history file. You have to do this to remove it all:
    1) Exit any of your current Terminal sessions (which saves it to ~/.bash_history)
    2) Open a new Terminal session and run "rm ~/.bash_history"
    3) Exit that session

    That should work. One thing I do if I don't want everything I typed in one session to be saved is I run "kill -9 $$" instead of exit. That forcibly kills the bash process and causes it to crash and close Terminal without saving history, while still preserving history from past sessions (kind of like an "incognito mode" for Terminal). I wouldn't always recommend that though because it kills bash, so if bash is trying to save anything that data might be corrupted, though I've never had a problem.
    Last edited by Stonecold1995; November 15th, 2012 at 06:06 AM.

  6. #6
    Join Date
    Oct 2008
    Beans
    3,509

    Re: Delete Terminal history?

    Edit: ALREADY SAID.

  7. #7
    Join Date
    Aug 2011
    Location
    51.8° N 5.8° E
    Beans
    3,372
    Distro
    Xubuntu 16.10 Yakkety Yak

    Re: Delete Terminal history?

    If you issue the command
    Code:
    HISTFILE=
    during your session the history won't be saved either. I thinks it's a cleaner way. Putting
    Code:
    export HISTFILE=
    in your .bashrc file disables your history permanently.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •