Linux/RedHat, CentOS, ubuntu

linux history 명령어 실행일시 표시하기

Pydole 2019. 10. 7. 17:07

간단히 환경변수를 추가하여 간단하게 history 명령어에 실행일시를 표시할 수 있다.

 

전역 적용시) /etc/Profile 파일 맨 아래 명령어 추가
root만 적용시) /root/.bash_profile 파일 맨 아래 명령어 추가

 

---------------------------------------------------------------------------

export HISTTIMEFORMAT="%Y-%m-%d_%H:%M:%S"

---------------------------------------------------------------------------

 

적용후 재로그인을 하고 history 명령어를 실행하면 아래와 같은 포맷으로 출력된다.

 

  973  2019-10-07_17:05:10 df -k
  974  2019-10-07_17:05:12 history