# history command



## Gherardo (Jun 8, 2014)

Hello,
I've a question about the history() command, but I can't find the answer in the manual.
On an old PC-BSD 9.2 install (I used it to get the hang of things BSD-wise) when I type `history` the output is the last 25 commands used, but the system keeps an history between session (there's a .history file in /root don't know if that's important).
On a fresh FreeBSD 9.2 install however `history` works only inside a session, if I reboot and invoke history again, the system shows nothing.
How can I have the computer 'save' history between sessions?
I'm using the default console csh(), if that's important.

Thanks in advance,

Gherardo


----------



## wblock@ (Jun 8, 2014)

csh(1) history actions are controlled by entries in .cshrc.  See `man csh | less -p 'history \['`.

It can get confusing when multiple terminals are open.  The last one to close overwrites ~/.history.  There are ways to load and merge the history with existing histories from other terminals.


----------



## Gherardo (Jun 9, 2014)

First of all, thank you for your input.

I read
csh(1) and I put, in .cshrc


```
set history=1000
set savehist=100
```

This should have, as I understood, save the first thousand entries between one hundred sessions.
Unfortunatly it did nothing, so I went back and re-read all the man.

At that point I noticed there was no .history file so I did `touch .history`, and now it works as intended.
I'm curious why .history wasn't automatically created, but everything's ok.

Thanks again,

Gherardo


----------



## SirDice (Jun 9, 2014)

Gherardo said:
			
		

> ```
> set savehist=100
> ```


You may want to use 
	
	



```
set savehist=(1000 merge)
```
Which is the default nowadays. The merge will merge the current session history with what's already in the .history file.


----------

