VMware Cloud Community
alvaropedroni
Enthusiast
Enthusiast
Jump to solution

Clear used commands on console esxi 6 ssh

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

1 Solution

Accepted Solutions
SupreetK
Commander
Commander
Jump to solution

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

View solution in original post

0 Kudos
11 Replies
RickVerstegen
Expert
Expert
Jump to solution

Try history -c. This should help you.

Was I helpful? Give a kudo for appreciation!
Blog: https://rickverstegen84.wordpress.com/
Twitter: https://twitter.com/verstegenrick
0 Kudos
SupreetK
Commander
Commander
Jump to solution

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

0 Kudos
alvaropedroni
Enthusiast
Enthusiast
Jump to solution

this command is only old version esx

0 Kudos
alvaropedroni
Enthusiast
Enthusiast
Jump to solution

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

SureshKumarMuth
Commander
Commander
Jump to solution

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

Regards,
Suresh
https://vconnectit.wordpress.com/
0 Kudos
SupreetK
Commander
Commander
Jump to solution

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

SureshKumarMuth
Commander
Commander
Jump to solution

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

Regards,
Suresh
https://vconnectit.wordpress.com/
0 Kudos
alvaropedroni
Enthusiast
Enthusiast
Jump to solution

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

0 Kudos
SupreetK
Commander
Commander
Jump to solution

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

alvaropedroni
Enthusiast
Enthusiast
Jump to solution

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

0 Kudos
SupreetK
Commander
Commander
Jump to solution

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

0 Kudos