WilliamLam.com

  • About
    • About
    • Privacy
  • VMware Cloud Foundation
  • VKS
  • Homelab
    • Resources
    • Nested Virtualization
  • VMware Nostalgia
  • Apple
You are here: Home / ESXi / Quick Tip - "poor mans" history command in ESXi

Quick Tip - "poor mans" history command in ESXi

02.19.2015 by William Lam // 1 Comment

When I am logged into the ESXi Shell, I often forget that history command is not implemented in ESXi which can be helpful when recalling the list of operations that had been executed in the past. I especially rely on the history command when I am tinkering around with things and once I am successful with the end result, I can easily go back and see the exact steps I took. Recently, I tried running history command only to be let down again as I forgot it was not implemented 🙁

I was thinking there had to be a way on ESXi and then it hit me! Starting with ESXi 5.1, all operations executed in ESXi Shell and Console were automatically logged to /var/log/shell.log. The information I was looking was there but instead of having to manually view the contents of the log, I could simply create an "alias" to  a history command which could display the last N-number of entries using the tail command.

Here is an example alias to "history" command to view the last 50 lines in /var/log/shell.log:

alias history="tail -50 /var/log/shell.log"

To make the alias permanent and persist across reboots, we just need to add the entry to /etc/profile.local

Now, I can run the history command on ESXi and get exactly what I want.

Screen Shot 2015-02-18 at 9.29.41 PM
Note: Entries in /var/log/shell.log contain more operations executed by all users. You can further refine the aliased command to search only for the current user, such as the root account.

More from my site

  • Programmatically accessing the Broadcom Compatibility Guide (BCG)
  • Supported chipsets for the USB Network Native Driver for ESXi Fling
  • Quick Tip - Auditing ESXi boot firmware type
  • Recovering ESXi 7.x & 8.x host after forgetting or losing root password
  • ESXi on ASUS NUC 14 Performance (Scorpion Canyon)

Categories // ESXi Tags // alias, cli, ESXi, history, shell

Comments

  1. *protectedAkram says

    02/20/2015 at 7:56 pm

    Really useful. Was looking for this !!

    Reply

Thanks for the comment!Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Search

Thank Author

Author

William is Distinguished Platform Engineering Architect in the VMware Cloud Foundation (VCF) Division at Broadcom. His primary focus is helping customers and partners build, run and operate a modern Private Cloud using the VMware Cloud Foundation (VCF) platform.

Connect

  • Bluesky
  • Email
  • GitHub
  • LinkedIn
  • Mastodon
  • Reddit
  • RSS
  • Twitter
  • Vimeo

Recent

  • Programmatically accessing the Broadcom Compatibility Guide (BCG) 05/06/2025
  • Quick Tip - Validating Broadcom Download Token  05/01/2025
  • Supported chipsets for the USB Network Native Driver for ESXi Fling 04/23/2025
  • vCenter Identity Federation with Authelia 04/16/2025
  • vCenter Server Identity Federation with Kanidm 04/10/2025

Advertisment

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy

Copyright WilliamLam.com © 2025

 

Loading Comments...