bash

Tricking bash HISTTIMEFORMAT

While trying to find a clean method to remove line numbers from the history command, I found an interesting trick by using the HISTTIMEFORMAT environment variable. Here’s what bash’s man says: HISTTIMEFORMAT If this variable is set and not null, its value is used as a format string for strftime(3) to print the time stamp associated with each history entry displayed by the history builtin. If this variable is set, time stamps are written to the history file so they may be preserved across shell sessions.