배워서 남주자/Linux 명령
[명령어 실행 기록] history 확인시 작업 날짜 표시하기
메그넘
2018. 3. 23. 14:29
.bash_history 작업 날짜 확인하기(세팅)
/etc/profile 파일에 아래 내용을 추가하여 "날짜/시간" 에 대한 기록을 추가해 준다.
# Add timestamp to .bash_history
HISTTIMEFORMAT="%Y-%m-%d_%d_%H:%M:%S "
export HISTTIMEFORMAT
[root@localhost /]# history
993 2017-05-30_09:40:54 vi /etc/profile
994 2017-05-30_09:40:54 history
995 2017-05-30_09:40:54 exit
996 2017-05-30_09:40:08 ls
997 2017-05-30_09:40:12 hostory
998 2017-05-30_09:40:14 history
999 2017-05-30_09:40:34 vim /etc/profile
1000 2017-05-30_09:40:50 exit
1001 2017-05-30_09:40:56 history
1002 2017-05-30_09:42:58 cd /var
1003 2017-05-30_09:42:59 ls
1004 2017-05-30_09:43:00 cd /
1005 2017-05-30_09:43:01 ls
1006 2017-05-30_09:43:16 find ./ -type d -name 'buffered'
1007 2017-05-30_09:43:25 find ./ -type d -name 'buffere'
1008 2017-05-30_09:43:37 find ./ -type d -name 'cache'
1009 2017-05-30_09:45:19 more /etc/profile
1010 2017-05-30_09:45:41 history
# Add timestamp to .bash_history
HISTTIMEFORMAT="%Y-%m-%d_%d_%H:%M:%S "
export HISTTIMEFORMAT
[root@localhost /]# history
993 2017-05-30_09:40:54 vi /etc/profile
994 2017-05-30_09:40:54 history
995 2017-05-30_09:40:54 exit
996 2017-05-30_09:40:08 ls
997 2017-05-30_09:40:12 hostory
998 2017-05-30_09:40:14 history
999 2017-05-30_09:40:34 vim /etc/profile
1000 2017-05-30_09:40:50 exit
1001 2017-05-30_09:40:56 history
1002 2017-05-30_09:42:58 cd /var
1003 2017-05-30_09:42:59 ls
1004 2017-05-30_09:43:00 cd /
1005 2017-05-30_09:43:01 ls
1006 2017-05-30_09:43:16 find ./ -type d -name 'buffered'
1007 2017-05-30_09:43:25 find ./ -type d -name 'buffere'
1008 2017-05-30_09:43:37 find ./ -type d -name 'cache'
1009 2017-05-30_09:45:19 more /etc/profile
1010 2017-05-30_09:45:41 history