FreeBSD History makeup
On last post I showed how to setup a long list timestamped bash history. In the last two months I had the opportunity to work on a set of FreeBSD (version 8) servers that come with CSH as default shell.
My first approaches with csh were not easy, and it seems I was in good company there, since when I was wandering around the web for tips to make my scripts work on csh shell I stumbled upon a couple of (not so nice) articles.
Along with obvious shell script issues, BSD seems not to work properly with my usual bash_history makeup. Plus, it comes with a limited 100 issued commands list.
Fixing that can be done by editing /etc/csh.cshrc
as follows:
set history = 10000
set savehist = 10000
echo "New Access Logged: `date`" >> ~/.history
Since it seems there is no way to teach history to show the full date, you may notice (last line of code above) the echo trick of appending the current date on the history file every time a new shell is spawned.
As usual, you have to issue
source /etc/csh.cshrc
in order to apply settings without need to disconnect from current shell.
Here’s an example of some history output on a FreeBSD system after the “makeup”:
197 12:42 New Access Logged: Tue Jan 31 12:42:57 CET 2012
198 12:43 cd /usr/local/backup/
199 12:43 ls -l
200 12:43 sh repulisti.sh