VMware vSphere

 View Only
Expand all | Collapse all

Clear used commands on console esxi 6 ssh

  • 1.  Clear used commands on console esxi 6 ssh

    Posted Sep 20, 2018 07:37 AM

    hello

    i have use command string with password  on ssh shell to esxi 6 console

    now

    when access to ssh console esx6 if using the arrows I can see the commands of old sessions.

    not find solution for clear command

    thanks



  • 2.  RE: Clear used commands on console esxi 6 ssh

    Posted Sep 20, 2018 08:01 AM

    Try history -c. This should help you.



  • 3.  RE: Clear used commands on console esxi 6 ssh

    Posted Sep 20, 2018 11:06 AM

    this command is only old version esx



  • 4.  RE: Clear used commands on console esxi 6 ssh
    Best Answer

    Posted Sep 20, 2018 09:08 AM

    I understand that you want the previously run commands to not show up when you use the up arrow mark on the ESXi command line. If yes, follow the below steps in order -

    1) Login to ESXi via SSH.

    2) Run the command "> /.ash_history" to null the history file.

    3) Logout and re-login. Now, it will not show you the previous commands when using up arrow mark.

    4) Irrespective of the user, all the commands are stored even in shell.log (under /var/run/log). You can clear that as well using the command "> /var/run/log/shell.log".

    Cheers,

    Supreet



  • 5.  RE: Clear used commands on console esxi 6 ssh

    Posted Sep 20, 2018 11:10 AM

    hello

    Yes, I know the shell.log file to delete

    your command for delete history working perfect

    you are the only person who has solved this problem. thank you



  • 6.  RE: Clear used commands on console esxi 6 ssh

    Posted Sep 20, 2018 01:49 PM

    Permission denied, when I try to run this command via root user on ESXi, any idea how we can bypass and run this command successfully.

    ~ # /.ash_history

    -sh: /.ash_history: Permission denied



  • 7.  RE: Clear used commands on console esxi 6 ssh

    Posted Sep 20, 2018 02:04 PM

    If you want to read the file, use the command 'less /.ash_history'. If you want to empty it out, use the command '> /.ash_history'. If it is still failing, share a screenshot of your ESXi screen with the error.

    Cheers,

    Supreet



  • 8.  RE: Clear used commands on console esxi 6 ssh

    Posted Sep 21, 2018 03:45 PM

    My bad I missed the important character '>' , it works like a charm. Thanks.



  • 9.  RE: Clear used commands on console esxi 6 ssh

    Posted Sep 28, 2018 11:02 AM

    thanks for your help for esxi 6.x

    do you know the same files to delete - and the same commands for vcenter vcsa 6.x too?

    thanks



  • 10.  RE: Clear used commands on console esxi 6 ssh

    Posted Sep 28, 2018 09:15 PM

    For vCSA, try the below steps -

    1) Login to vCSA via SSH using the root account.

    2) Enable shell.

    3) Run the command "cd /" to navigate to the root dir.

    4) Run the command "> /root/.bash_history" to null the history file.

    5) Logout and re-login.

    Cheers,

    Supreet



  • 11.  RE: Clear used commands on console esxi 6 ssh

    Posted Sep 29, 2018 11:18 AM

    hello

    your command working perfect

    but when re-login on vcsa the history show only command:

    cd /           and         > /root/.bash_history

    and another command i cleaner .... is correct?

    the vcsa have file to permanent history shell.log to delete??

    thanks



  • 12.  RE: Clear used commands on console esxi 6 ssh

    Posted Sep 29, 2018 11:24 AM

    AFAIK, there is no other shell.log file for vCSA. .bash_history could be the only one. It will show you that command since that was the one used to null the file.

    Cheers,

    Supreet