Change timestamp format for history command on csh

The first word indicates the number of history events to save. The optional second word (+) indicates the format in which history is printed; if not given, %h\t%T\t%R\n is used. The format sequences are described below under prompt; note the variable meaning of %R. Set to 100 by default.

 

Example

$ set history= ( 1000 “%h %W/%D/%Y %T %R\n” )

Results in:

$ history
2 09/08/2014 22:48 set history= ( 1000 “%h %W/%D/%Y %T %R\n” )
7 09/08/2014 22:49 ls
9 09/08/2014 22:49 echo “hi”
10 09/08/2014 22:49 history

This would result in the history being maintained for the last 1000 commands with the format of “%h %W/%D/%Y %T %R\n”.

  • %h – history #
  • %W/%D/%Y – month/day/year
  • `%T – 24 hr. time
  • %R – command run

The full descriptions of these macros is defined in the tcsh man page, scroll down to the section where the prompt command is explained. They’re there.

1 comentário

Deixe um comentário

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *