Operating System - Tru64 Unix
1748165 Members
3840 Online
108758 Solutions
New Discussion юеВ

Re: the file fo .sh_history

 
SOLVED
Go to solution
hy_3
Frequent Advisor

the file fo .sh_history

Under a user's home directory,there is a file named .sh_history.It records some operations of the users.But in my machine a user's .sh_history does not record any operations.Os is 5.1A.What is the reason?Thank you.
6 REPLIES 6
Ninad_1
Honored Contributor

Re: the file fo .sh_history

This file is used for keeping history of commands in ksh and csh shells.
If you are using ksh as your shell you can view commands in history using command
$fc -l
You can re-execute commands in history using command number shown in fc -l using command
$fc -s command_no

for csh you need to define history size in the .cshrc file in users home directory

Hope this helps

Regards
Ninad
Joris Denayer
Respected Contributor
Solution

Re: the file fo .sh_history

Hi,

With ksh, you can change the name of the historyfile with the HISTFILE variable.

I use following value
HISTFILE=$HOME/.history_$$

This gives you an separate historyfile for each kshell. Usefull when you run many sessions together.

Joris
To err is human, but to really faul things up requires a computer
hy_3
Frequent Advisor

Re: the file fo .sh_history

Thank you.My question is now there is not any recode in the .sh_history file.I am using ksh.What is the reason?
hy_3
Frequent Advisor

Re: the file fo .sh_history

Thank Joris.I use your way,and it works fine.But I still have a question that what is the reason why there is nothing in the .sh_history file.
Joris Denayer
Respected Contributor

Re: the file fo .sh_history

I guess that the .sh_history file is a remnant of a session with no HISTFILE variable defined.
Verify the last modification time of the file. (ls -l /.sh_history)
Joris
To err is human, but to really faul things up requires a computer
Michael Schulte zur Sur
Honored Contributor

Re: the file fo .sh_history

Hi,

the history file records only commands, that are typed in manually. If the user is directed into an application or shell script and does work on shell level, then you will not see anything either.

greetings,

Michael