1829103 Members
2536 Online
109986 Solutions
New Discussion

histfile in csh

 
SOLVED
Go to solution
Deniz Cendere
Frequent Advisor

histfile in csh

Hi all,

I have a critical system which have many users. I want to log a data which contains who run which command at what time and connected from which ip. In ksh I can do it with setting the HISTFILE variable to export HISTFILE=/usr/history/user_hist/${usr}_${user}_$$.tmp in the /etc/profile. For csh and tcsh, I did the same settings in csh.login file but it didn't run. Also I did the same settings in users profile (.cshrc and .login) but no change. Can't we do this kind of setting in csh? If so what can I do for logging the users.

Thanks,
13 REPLIES 13
Mugilvannan
Valued Contributor

Re: histfile in csh

set this in .cshrc file set history=200. It will work.
If U need a helping hand, U will find one at the end of your arm
Muthukumar_5
Honored Contributor

Re: histfile in csh

Try this as,

.login file in your HOME Directory as,

set history=1000

and save it.

Next login for that account will be with history.

hth.
Easy to suggest when don't know about the problem!
Arunvijai_4
Honored Contributor

Re: histfile in csh

Try using setenv history=300 in .cshrc file. ( set is used for this shell and setenv for this and any subshells)

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Cem Tugrul
Esteemed Contributor

Re: histfile in csh

Deniz Selam,

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=723200

Good Luck,
Our greatest duty in this life is to help others. And please, if you can't
Deniz Cendere
Frequent Advisor

Re: histfile in csh

I did the following;
set history = 256
set savehist = 256 merge

It writes to .history file but it doesn't write to /usr/history/user_hist/${usr}_${user}_$$.tmp file.


Muthukumar_5
Honored Contributor

Re: histfile in csh

There is no functionality available to set HISTFILE in csh by default. You have to change your own auditing with script .cshrc or .login file to audit in user defined manner.

hth.
Easy to suggest when don't know about the problem!
H.Merijn Brand (procura
Honored Contributor

Re: histfile in csh

Sure there is!

edit /etc/csh.login

works for csh and tcsh users. No need to enable that on individual basis

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
Arunvijai_4
Honored Contributor

Re: histfile in csh

Try this link,

http://wks.uts.ohio-state.edu/unix_course/intro-61.html

it may help.

-AV
"A ship in the harbor is safe, but that is not what ships are built for"
Deniz Cendere
Frequent Advisor

Re: histfile in csh


Unfortunately,

I set it in /etc/csh.login. It doesn't work.
I set it also in .login and .cshrc files in the home directory of a user.
In both of them it doesn't write to the file that I've set.
"setenv HISTFILE /usr/users/`whoami`/.history_$$"

When I look this link, I can't see a variable of "histfile".
http://wks.uts.ohio-state.edu/unix_course/intro-61.html

Can't we set this variable in csh?

Thanks,
Arunvijai_4
Honored Contributor
Solution

Re: histfile in csh

Only tcsh supports histfile, not c shell.

-AV
"A ship in the harbor is safe, but that is not what ships are built for"
Mugilvannan
Valued Contributor

Re: histfile in csh

If you want to have your designated histfile then use tcsh. Setting is simple with savehist and histfile variables.

-mugil
If U need a helping hand, U will find one at the end of your arm
Stephen Keane
Honored Contributor

Re: histfile in csh

Don't forget

set savehist=xxx

To actually save the history when the user logs out.
Deniz Cendere
Frequent Advisor

Re: histfile in csh

Thanks to everyone,

When I change the shell to tcsh, it worked.
So csh doesn't support histfile,
tcsh supports it.

Deniz,