history command with date


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting history command with date
# 1  
Old 01-25-2012
history command with date

Hi All,

Can i get the history command with date, so that i can know which command run at what time???



need it on urjent basis


Thanks
# 2  
Old 01-25-2012
Code:
export HISTTIMEFORMAT="%h/%d - %H:%M:%S"

--ahamed
# 3  
Old 01-25-2012
tried the above code as it is but not getting output

Code:
[user01@vm10 sbp]$ export HISTTIMEFORMAT="%h/%d - %H:%M:%S"
[user01@vm10 sbp]$

# 4  
Old 01-25-2012
After that, you need to execute the history command to see the history with time stamp!
If you need it always, better to add this in ~ /.profile or any other appropriate place!

--ahamed
# 5  
Old 01-25-2012
bash specific ! doesn't work whith ksh

Jean-Pierre.
# 6  
Old 01-27-2012
Quote:
Originally Posted by ahamed101
After that, you need to execute the history command to see the history with time stamp!
If you need it always, better to add this in ~ /.profile or any other appropriate place!

--ahamed

Its showing me todays current date only..... not exact time at what the command is executed
# 7  
Old 01-27-2012
That should show the date & time... Otherwise try this:

Code:
export HISTTIMEFORMAT='%F %T '

This is just mentioning about the history time format... You'll have to execute ''history'' command to see the output..

Moderator's Comments:
Mod Comment Removed Link: Please do not use the forums to over promote your web site by posting links, Thanks
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

History of command by date

hi unix expert how can i see the history of command that i entered in past? history (1 Reply)
Discussion started by: abdossamad2003
1 Replies

2. Shell Programming and Scripting

History of all the users in single file with command , date . time , ip and user

HTML Code: archive_history() { HISTORYOLD=${HISTFILE}.archive CURTIME=`date` CURTTY=`tty` IP=$(echo $SSH_CLIENT | awk '{print $1}') if ; then echo "#-${HOSTNAME}-- ${CURBASHDATE} - ${CURTIME} ($CURTTY) ${USER} ${IP}----" >> $HISTORYOLD history... (0 Replies)
Discussion started by: rehantayyab82
0 Replies

3. Shell Programming and Scripting

History of all the users in single file with command , date . time , ip and user

HTML Code archive_history() { HISTORYOLD=${HISTFILE}.archive CURTIME=`date` CURTTY=`tty` IP=$(echo $SSH_CLIENT | awk '{print $1}') if ; then echo "#-${HOSTNAME}-- ${CURBASHDATE} - ${CURTIME} ($CURTTY) ${USER} ${IP}----" >> $HISTORYOLD history... (2 Replies)
Discussion started by: rehantayyab82
2 Replies

4. UNIX for Dummies Questions & Answers

Command history

hi i want to show my history command in UNIX solaris ( bash shell ),, i tried this command ( HISTTIMEFORMAT="%d/%m/%y %T " ) but it's not working with me ,, is there any restricted condition to do this command any one know why it's not working to me .. thanks (10 Replies)
Discussion started by: mondo32
10 Replies

5. UNIX for Dummies Questions & Answers

Want to get list of Linux commands used on specific date through HISTORY command

I want to get list of linux commands used on Jan 01 2014 with the help of HISTORY command or some other linux commands,. Kindly help. (3 Replies)
Discussion started by: karthick nath
3 Replies

6. Shell Programming and Scripting

Need to view command in history for specific date

hi i want to find a command in history for specific date . is it possible that i can view ?? (1 Reply)
Discussion started by: scriptor
1 Replies

7. AIX

History command

How to get the other user history file. I would like to check the commands issues from my teammate. (1 Reply)
Discussion started by: Mariappan.m
1 Replies

8. UNIX for Dummies Questions & Answers

The history command: See other users command history

Can anyone tell this: If two users are logged into the same server from different locations. Is there a way to see the history command of the other user? I tried the history command, but it is showing me only the commands I used. Thanks in advance for your help. Iamnew2solaris (1 Reply)
Discussion started by: iamnew2solaris
1 Replies

9. UNIX for Dummies Questions & Answers

using command history

Hi All. Suppose I am in a "verylongpath" directory and I type "gedit thisfile". At a later stage, the command is accessible from the hystory, but it is useless if I have moved to another directory. The same applies to "cd myfolder", etc. Is there a way to instruct shell history to... (1 Reply)
Discussion started by: bruno69
1 Replies

10. Shell Programming and Scripting

Date/Time in history command

Hi, Can we display the Date/time stamp in history command Ex: $history output ----------- vi pr.sh ksh -x pr.sh ksh -n pr.sh nhoup ksh pr.sh & nohup ksh pr.sh & i want the output like this Tue Mar 14 17:18:57 GMT 2006 vi pr.sh HOSTNAME is it possible sir ???? (3 Replies)
Discussion started by: vastare
3 Replies
Login or Register to Ask a Question