Skip to main content
internal format for time
Source Link
meuh
  • 54.7k
  • 2
  • 70
  • 138

Not quite what you wanted, but you can get bash to add timestamps to each line in the history automatically. Simply set, for youyour example:

HISTTIMEFORMAT="%d%b%y%T "

You getThe history command with no arguments will then show your history entries like this:

07Jul150923Jul1515:0748:0714 ls -ld .

The history -w command however always writes the history file in the internal format of:

#1437659315
ls -ld .

i.e. on 2 lines, the first line holds the time in seconds "since the epoch" (i.e. 1 jan 1970) with a # in front so that it will not be confused with a command.

Not quite what you wanted, but you can get bash to add timestamps to each line in the history automatically. Simply set, for you example:

HISTTIMEFORMAT="%d%b%y%T "

You get entries like

07Jul1509:07:07 ls -ld .

Not quite what you wanted, but you can get bash to add timestamps to each line in the history automatically. Simply set, for your example:

HISTTIMEFORMAT="%d%b%y%T "

The history command with no arguments will then show your history entries like this:

23Jul1515:48:14 ls -ld .

The history -w command however always writes the history file in the internal format of:

#1437659315
ls -ld .

i.e. on 2 lines, the first line holds the time in seconds "since the epoch" (i.e. 1 jan 1970) with a # in front so that it will not be confused with a command.

Source Link
meuh
  • 54.7k
  • 2
  • 70
  • 138

Not quite what you wanted, but you can get bash to add timestamps to each line in the history automatically. Simply set, for you example:

HISTTIMEFORMAT="%d%b%y%T "

You get entries like

07Jul1509:07:07 ls -ld .