Results 1 to 7 of 7
  1. #1
    Join Date
    Apr 2004
    Posts
    58

    Lightbulb Unanswered: Clear history on z-Linux and AIX servers

    Does anyone know the command on how to clear previous commands issued on AIX and Linux operating systems?

    I tried "history -c" and "history clear" but did not work.

    I did "history -100" and saw all the previous commands I executed, even after I logged off from the session. For security concerns, I would like to clear all the command history.

    Any inputs would be greatly appreciated.

    Thanks in advance.

  2. #2
    Join Date
    Sep 2009
    Location
    Ontario
    Posts
    1,057
    Provided Answers: 1
    rm ~/.bash_history

    Or vi ~/.bash_history and remove the incriminating lines.

  3. #3
    Join Date
    Apr 2004
    Posts
    58
    I tried both. They cleared up most of the history. Now see the last 15 or so commands I typed when issued "history".

    How can I clear all previous commands?

    Thanks for your help.

  4. #4
    Join Date
    Sep 2009
    Location
    Ontario
    Posts
    1,057
    Provided Answers: 1
    I don't think that you can. There seems to be a buffer of a hundred characters or so that gets written to the file when you log off. The best might be to fill the buffer with commands like "date" or "ls -l" etc.

  5. #5
    Join Date
    Sep 2009
    Location
    Ontario
    Posts
    1,057
    Provided Answers: 1
    Was reading the manual page for something else this morning, and I see that ksh-93, includes a "hist" command that "Using the hist built-in command within a compound command will cause the whole command to disappear from the history file"

  6. #6
    Join Date
    Apr 2004
    Posts
    58
    "using hist built-in command within a compound command will cause the whole command to disappear from the history file"

    I wonder what the command is.... please let me know if you find out.

    Really appreciate you looking into this.

    Thanks again!

  7. #7
    Join Date
    May 2005
    Location
    South Africa
    Posts
    1,365
    Provided Answers: 1
    rm ~/.bash_history # clear hist file
    kill -9 $$ # kill your process to kill cash

Posting Permissions

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