LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > AIX
User Name
Password
AIX This forum is for the discussion of IBM AIX.
eserver and other IBM related questions are also on topic.

Notices


Reply
  Search this Thread
Old 02-17-2009, 12:22 PM   #1
shipon_97
Member
 
Registered: Oct 2005
Location: Bangladesh
Posts: 504

Rep: Reputation: 31
history cammand with date format !!!


Friends ,

In aix unix server I can see the the 'history' command with exporting this line " export HISTTIMEFORMAT="%D%T - "" from the "bash" sehll . But I cannot see history command with date using " export HISTTIMEFORMAT="%D%T -"" from "ksh" shell .

Like ,

bash-3.00$ export HISTTIMEFORMAT="%D%T - "
bash-3.00$ history
2 02/18/0900:15:14 - df -g
3 02/18/0900:15:17 - pwd
4 02/18/0900:15:22 - history

Here I see with the date format .

But in ksh shell ,


$ export HISTTIMEFORMAT="%D%T - "
$ history
876 absh
877 bash
878 bash
879 clear
880 bash-3.00$ history
881 2 02/18/0900:15:14 - df -g
882 3 02/18/0900:15:17 - pwd
883 4 02/18/0900:15:22 - history
884 clear
885 export HISTTIMEFORMAT="%D%T -
886 clear
887 export HISTTIMEFORMAT="%D%T -
888 bash
889 clear
890 export HISTTIMEFORMAT="%D%T - "
891 history


I cannot see the date with the line here .

Can u plz tell me why it is happening and how can i see it in the ksh shell ?
 
Old 02-17-2009, 12:46 PM   #2
ncsuapex
Member
 
Registered: Dec 2004
Location: Raleigh, NC
Distribution: CentOS 2.6.18-53.1.4.el5
Posts: 770

Rep: Reputation: 44
Not sure about AIX but in linux you can add this line to your /etc/profile:

HISTTIMEFORMAT="%c # "


might have to log out and log back in to see the results.
 
Old 02-17-2009, 01:05 PM   #3
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
In ksh HISTTIMEFORMAT has no effect at all. Here is the difference between environment variables related to history:
Code:
	/bin/ksh	/bin/bash
			HISTCONTROL
	HISTCMD	
        HISTEDIT
        HISTFILE	HISTFILE
        HISTSIZE        HISTSIZE
                        HISTFILESIZE
			HISTIGNORE
			HISTTIMEFORMAT
 
Old 02-17-2009, 01:13 PM   #4
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Just out of curiosity I googled and found this:
Quote:
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
Also this (related to linux)
Quote:
ksh doesn't have any feature intended to put timestamps in history. You can get a similar effect by combining the evaluation of the PS1 prompt and the "read -s" feature that reads into history.

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

This prompt setting will put the current date and time into the history each time ksh comes back to printing a prompt. The timestamp will appear as a separate line. It will show the time that the preceeding command completed. You won't be able to know exactly when a long-running command was started. (The bash timestamp feature shows the start times of entered commands and doesn't show when they finish).
Hope one of these solutions fit your needs.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
History command with system date shipon_97 Linux - Newbie 5 12-26-2009 02:41 AM
How can I append the date/time stamp to commands in history? abefroman Linux - Security 2 05-29-2008 11:21 AM
date format monu Linux - Newbie 6 10-08-2007 10:47 AM
History command, How to get the date? philipina Linux - General 2 08-05-2004 05:58 PM
tcsh history display format k4zau Linux - Software 1 10-12-2003 10:42 PM

LinuxQuestions.org > Forums > Other *NIX Forums > AIX

All times are GMT -5. The time now is 09:10 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration