본문 바로가기

0과 1 그 끝없는 세상/IBM AIX

[history] How to use the timestamp in command history file on AIX 5.3 with Korn Shell

0. I checked that this works in AIX 5.3 TL08 with Korn Shell (I've known that It works on AIX 5.3 or above)

1. You can simply use the timestamp in ~/.sh_history or history command with turning on the EXTENDED_HISTORY.
- add this in /etc/profile or ~/.profile
export EXTENDED_HISTORY=ON

2. If you want to see the timestamp, then use this command
[localhost:root] # history -t
2061    2011/01/31 16:10:40 :: fc -t
2062    2011/01/31 16:20:13 :: vi /etc/profile
2063    2011/01/31 16:20:25 :: lr
2064    2011/01/31 16:20:29 :: ls
2065    2011/01/31 16:20:31 :: fc -t
2066    2011/01/31 16:20:33 :: history
2067    2011/01/31 16:20:46 :: history -t
2068    2011/01/31 16:20:55 :: vi .sh_history
2069    2011/01/31 16:21:01 :: lr
2070    2011/01/31 16:21:09 :: history -t 0
2071    2011/01/31 16:21:21 :: exit
2072    2011/01/31 16:21:29 :: history
2073    2011/01/31 16:21:31 :: exit
2074    2011/01/31 16:25:24 :: cat /etc/profile
2075    2011/01/31 16:29:02 :: history -t
[localhost:root] # fc -t
2061    2011/01/31 16:10:40 :: fc -t
2062    2011/01/31 16:20:13 :: vi /etc/profile
2063    2011/01/31 16:20:25 :: lr
2064    2011/01/31 16:20:29 :: ls
2065    2011/01/31 16:20:31 :: fc -t
2066    2011/01/31 16:20:33 :: history
2067    2011/01/31 16:20:46 :: history -t
2068    2011/01/31 16:20:55 :: vi .sh_history
2069    2011/01/31 16:21:01 :: lr
2070    2011/01/31 16:21:09 :: history -t 0
2071    2011/01/31 16:21:21 :: exit
2072    2011/01/31 16:21:29 :: history
2073    2011/01/31 16:21:31 :: exit
2074    2011/01/31 16:25:24 :: cat /etc/profile
2075    2011/01/31 16:29:02 :: history -t