timestamp in .sh_history using ksh shell


 
Thread Tools Search this Thread
Operating Systems AIX timestamp in .sh_history using ksh shell
# 1  
Old 03-09-2008
timestamp in .sh_history using ksh shell

Hello Everyone:

Does anyone know how I will setup my account to put timestamp in my .sh_history? I do not hold the root account. I am using AIX 5 and ksh shell. I tried every solution I can find in the internet but nothing seems to work OR I am just applying those in the wrong way. Anyone knows a "sure" way? I would appreciate your help. Thanks.

~Orbix
# 2  
Old 03-09-2008
ksh does not have support for adding timestamps to the command history file.

A common hack is to modify PS1 to add a timestamp line into the command history file each time the PS1 prompt is output.

Code:
PS1='$(printf "%(%D %T )T" | read -s)$ '

Note that the Bash command history timestamp shows the time each command is started. This hack shows the time each command finishes.
# 3  
Old 03-11-2008
I put the "PS1=..." command in my .profile but it didn't work when I look at the .sh_history
Code:
PS1=....
export

# 4  
Old 03-11-2008
I put the "PS1=..." command in my .profile but it didn't work when I look at the .sh_history
Code:
PS1='$(printf "%(%D %T )T" | read -s)$ '
export PS1

# 5  
Old 03-11-2008
AIX supports timestamps in the ksh and ksh93 shell history from AIX 5.3 on. Export EXTENDED_HISTORY=ON from the /etc/profile or your ~/.profile (no need to be root) and check with fc -t.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

sh_history file

Hi, I'm on a linux machine. But I see that sh_history is not updated since february 15. How is it possible ? Thank you. uname -a Linux MYSERVER 2.6.18-194.11.3.el5PAE #1 SMP Mon Aug 23 15:57:10 EDT 2010 i686 i686 i386 GNU/Linux ls -al -rw------- 1 oracle dba 3644 fév 15 09:28... (10 Replies)
Discussion started by: big123456
10 Replies

2. AIX

Looking at .sh_history file.

I reviewed a couple old post where shockneck posted the use of the EXTENDED_HISTORY=ON variable to place a timestamp in the .sh_history file when using ksh and using the fc -t command to read the .sh_history file. The fc command reads my history file. As an admin I would like to be able to read... (5 Replies)
Discussion started by: juredd1
5 Replies

3. UNIX for Dummies Questions & Answers

timestamp in C shell

Hi, I am using C Shell. Can someone please let me know how can I get current timestamp in seconds? In Borne shell it seems %s will give the output. Similarly what is for C shell? Thanks -Durga (3 Replies)
Discussion started by: adurga
3 Replies

4. UNIX for Advanced & Expert Users

In ksh find out the timestamp of current date?

Normally we can use %s to find out the time in second since 1970. But in my ksh, this format option is not available. Example- date +%s 1268103151 above script command won't work in ksh. Can you guys provide its equivalent ? (3 Replies)
Discussion started by: boy18nj
3 Replies

5. UNIX for Advanced & Expert Users

Incoherence between finger and .sh_history

Hello, I've a script that verifies users connections. This is the check part do NEVER=$(finger $USER | grep -i Never) if then NAME=$(finger $USER | grep -i "In real life" | sed -e 's/^.*life: //') echo $USER $NAME >> never_logged #" "$NEVER fi done that for a specific... (6 Replies)
Discussion started by: gogol_bordello
6 Replies

6. Shell Programming and Scripting

How to get timestamp of file into ksh script

Hi - I need to run a script via cron which will do some ldapsearches. One of the search parameters will be modifytimestamp. I need to have some way of storing the timestamp of the last time the script ran, and then retrieving that timestamp to use in the ldapsearch command (i.e.... (5 Replies)
Discussion started by: sniper57
5 Replies

7. Shell Programming and Scripting

Timestamp to date conversion in ksh

Hi, I have a file containing timestamp( Example given below). How can i get date(mmd-dd-yyyy) from it? ($> cat file1.txt 2008-11-24 05:17:00.7043) Thanks, Sri (2 Replies)
Discussion started by: srilaxmi
2 Replies

8. AIX

history .sh_history sh_history

hi what's the difference between .sh_history and sh_history for root user? thanks itik (1 Reply)
Discussion started by: itik
1 Replies

9. Shell Programming and Scripting

I want to get timestamp from a text file using ksh

for example : 07:25 Thanks (1 Reply)
Discussion started by: vinna
1 Replies

10. UNIX for Advanced & Expert Users

.sh_history file

Hi Friends, We are currently 5 people using same Unix login-id on different terminals, .sh_history file contains list of commands typed by all 5 peoples(commands history) with the below list : $tail .sh_history ls -ltr pwd cd .. ls -ltr clear cd temp more kk.lst Now my question... (9 Replies)
Discussion started by: krishna
9 Replies
Login or Register to Ask a Question