Linux ETC

 [ history 조회시 '날짜,시간' 표시하기 ]


  history로 사용자가 입력했던 명령어를 조회할때 "언제" 실행 했는지를 알아야 할 때가 있습니다.
  /etc/profile에 HISTTIMEFORMAT 변수를 추가해 주면 history 조회시 해당 명령어를 입력한 날짜,

  시간이 표시 됩니다.


1. /etc/profile에 아래 내용 추가


  # vi /etc/profile

  HISTTIMEFORMAT="%F %T -- "
  export HISTTIMEFORMAT


2. 적용

  # source /etc/profile


3. 확인


  # history

  424  2012-03-15 18:48:16 -- vi /etc/profile
  425  2012-03-15 18:48:22 -- source /etc/profile
  426  2012-03-15 18:48:25 -- history