How to view shell history in ESXi

In ESXi 5.x and above, you can move the up/down arrow keys to view previously executed commands. But you can’t run history, it’s not there.
Shell commands are logged in /var/log/shell.log

~ # cat /var/log/shell.log
2016-02-29T22:06:05Z SSH: SSH login enabled
2016-02-29T22:06:05Z ESXShell: ESXi shell login enabled
2016-02-29T22:06:27Z ESXShell: ESXi Shell available
2016-02-29T22:10:15Z shell[36047]: Interactive shell session started
2016-02-29T22:10:23Z shell[36047]: [root]: ipconfig
2016-02-29T22:10:54Z shell[36047]: [root]: ifconfig
2016-03-01T01:32:37Z shell[69121]: Interactive shell session started
2016-03-01T02:19:18Z shell[69121]: [root]: exit
2016-03-10T19:26:32Z shell[2409109]: Interactive shell session started
2016-03-10T19:26:37Z shell[2409109]: [root]: ls
2016-03-10T19:26:55Z shell[2409109]: [root]: cd tmp
2016-03-10T19:26:57Z shell[2409109]: [root]: dir

ESXi 4.x

In ESXi 4.x, the shell commands are logged in the messages log file. To view the shell commands, run this command:
grep shell /var/log/messages



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s