Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
09-30-2007, 12:03 PM
|
#1
|
Member
Registered: Oct 2005
Location: Bangladesh
Posts: 504
Rep:
|
History command with system date
Dear Friends ,
I need a command which helps to execute "history" command with system date ,
i.e.,
I can set the time in history so that I will get a better idea at what time the command was fired .
Plz help me to give some information about this ... ...
|
|
|
09-30-2007, 12:17 PM
|
#2
|
LQ Guru
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509
|
You have to define the environment variable HISTTIMEFORMAT. The format is expressed in the same way as the command date (see man date for details). For example, defining the following in your ~/.bashrc
Code:
export HISTTIMEFORMAT="%H:%M:%S - "
will give a history like
Code:
208 18:10:57 - history
209 18:10:58 - ls
210 18:11:01 - cd
|
|
|
10-01-2007, 12:26 PM
|
#3
|
Member
Registered: Oct 2005
Location: Bangladesh
Posts: 504
Original Poster
Rep:
|
'history' command contains more logs, how to ?
Thx colucix for ur reply .
I have another question .
By default how many logs the 'History' command contains ?
If I want to see the logs of history command
before 6 month (or more) ago , then what will I do ?
waiting for ur kind reply ... ..
|
|
|
10-01-2007, 01:15 PM
|
#4
|
LQ Guru
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509
|
Quote:
Originally Posted by shipon_97
By default how many logs the 'History' command contains ?
|
It depends from other environment variables related to history. HISTSIZE sets the number of commands saved in a single session, HISTFILESIZE sets the max number of commands stored in the history file. Look at these environment variables in your setup: most likely they will be set to 1000 (default values).
Quote:
If I want to see the logs of history command
before 6 month (or more) ago , then what will I do ?
|
It is not a good idea to increase the HISTFILESIZE to a very high value, since the file .bash_history will increase in size. If the purpose is to archive past commands somewhere in a text file, you may think to periodically (e.g. once a week) copy .bash_history or append its content to a backup file. You can do this automatically by means of a crontab job.
|
|
|
12-26-2009, 12:53 AM
|
#5
|
Member
Registered: Oct 2005
Location: Bangladesh
Posts: 504
Original Poster
Rep:
|
history with date command in AIX platform !!
Thx colucix ,
I have another problem in AIX 5.3 server platform . By default when I use "history -t" then it shows the command history using time/date .
$ history -t
886 2009/12/23 13:04:33 :: bash
887 2009/12/23 16:03:01 :: bash
888 ? :: ls
889 ? :: sh rmanincremental.sh
890 ? :: exit
891 2009/12/24 09:20:11 :: bash
892 2009/12/24 09:24:00 :: bash
893 2009/12/24 09:25:03 :: bash
894 2009/12/24 10:19:43 :: bash
895 2009/12/24 14:49:20 :: bash
896 ? :: ls
897 ? :: sh rmanfull.sh
898 ? :: df -g
899 2009/12/26 09:32:28 :: bash
900 2009/12/26 09:54:40 :: bash
901 2009/12/26 11:10:18 :: history -t
But the problem is , some command (which is not related the o/s command) are not display the date/time value , (it shows ? sign instead) . Would you plz help me How can I add date/time value with this command in AIX unix platform ?
Waiting for kind reply ... ...
|
|
|
12-26-2009, 03:41 AM
|
#6
|
LQ Guru
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509
|
Sorry, but I'm not an expert on AIX systems. By the way, did you give a look at the answers in this other thread of yours? Cheers.
|
|
|
All times are GMT -5. The time now is 03:03 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|