The Shell History file has saved my bacon many, many times. So many times I have used it to figure out what happened with a server after some kind of problem, or to find a command I had run before that I couldn't remember. The Shell history paints a very good picture of what has occurred on a server and is one of the first places I start when troubleshooting a server to see what has recently been happening.
It can also help document the configuration on a server. I remember many years ago we were having issues with a VIO SEA adapter and had to recreate it. Luckily we found the original command that was used to create the SEA in the history file so it was a piece of cake for us to recreate it.
By default the AIX history has a couple of limitations:
The default size of the history file is 500 lines for root and 128 lines for other users.
The history file doesn't record what date/time commands were run.
Many of these low limits we see today are archaic leftovers from a time long ago when computers had extremely limited resources. For example, one thing that drives me crazy is the default scroll back buffer of the popular PuTTY SSH client is only 200 lines! In an era of desktops with at least several Gigabytes of memory we certainly have room to store more than 200 measly lines of text! Luckily it is very easy to change the default scroll back buffer in PuTTY to something more reasonable like 10 million lines..
So in today's modern AIX environments where servers are often connected to terabytes of storage and often have hundreds of Gigabytes of RAM I think we have room to store a little more than 500 lines of shell history as well.
By default the AIX shell history file doesn't record the date/time stamp for each command that is run. This reduces the usefulness of the history file because the commands in it could have been run 10 minutes ago or 10 months ago, you just can't tell one way or the other. When troubleshooting an issue it can be extremely useful to be able to see that a command in the shell history was run at the same time a problem began.
Luckily it is extremely easy to fix both of these limitations with the default AIX Shell History. Simply add these lines to your global /etc/profile file:
These will increase the history size to 10,000 lines and record date/time stamps for each command run. Use the "-t" flag with the history command to see the date/time stamps next to each command.
Hopefully these simple tips will allow you to get more out of the AIX Shell History.