Date/Time in history command


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Date/Time in history command
# 1  
Old 03-15-2006
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 ????

I post this question with the new thread ...pls consider Smilie

Thanks in advance
-----------
VASTARE
# 2  
Old 03-15-2006
Quote:
Originally Posted by GCTEII
printmsg() {

CMD=$1
LOGDATE=`date '+%c'`
HOSTNAME=`hostname`
log=/tmp/test/msg.tmp

printf "%s %s %s \n" ${LOGDATE} ${CMD} ${HOSTNAME} >> ${log}

}
Create a function to do it.
printmsg "test"
# 3  
Old 03-15-2006
Thanks alot,

But i really dont know how to perform that, can u help in this?

In which file can we find "HISTFILE " "HISTSIZE" these 2 variable ???

i want to know ...How the history command is working ?????

Thanks in advance
# 4  
Old 03-15-2006
Well if we type history command in UNIX prompt, it will display the command executed by user Smilie

I want to know that which script is executing.... when we execute history command???? Smilie

How the UNIX is managing the history command????

Please i want know the in/out details of history command......

And I want to write my own history script ......give me a hint to do this???? Smilie

Help me out from this confusion Smilie
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

Date command - subtract from given time

the given time is: 12:13:00 how do i subtract a 10 minutes from any given time? date '12:13:00' '-10 min' also tried this: date +12:13:00 '-10 min' (2 Replies)
Discussion started by: SkySmart
2 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... (0 Replies)
Discussion started by: rehantayyab82
0 Replies

4. 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

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. Shell Programming and Scripting

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 (6 Replies)
Discussion started by: aish11
6 Replies

8. Shell Programming and Scripting

Date/Time for command

Hello all, Part of a script I am writing needs to check for a certain date.. example If it is saturday between 1pm and 2pm, kick off this script.../directory/script.sh need some pointers as to what the best way to do this is. (3 Replies)
Discussion started by: jeffs42885
3 Replies

9. Solaris

Can history commands show what time command executed

On Solaris 8 and 10 is there a way history command can show what time a particular command was executed. Pls reply. Thanks (2 Replies)
Discussion started by: Tirmazi
2 Replies

10. UNIX for Dummies Questions & Answers

Time & Date Command

Hey all, When you run the 'ls -la' command it'll show you the time and dates of all files/directories. Now what I am trying to do is create a script that will tell me what files haven't been used in over the past 1 month and what the time and date is that the files that haven't been accessed in... (2 Replies)
Discussion started by: merlin
2 Replies
Login or Register to Ask a Question