Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using tcsh quite extensively and have several questions about it's history:

  • Is there a way to save commands for different shell tabs separately?
  • Is there a way to save commands by session (for cases like this: ssh otheruser@othercomputer)?
  • Can I add dates to the shell history? (I know this can be done in bash)
share|improve this question

migrated from May 7 '12 at 21:46

This question came from our site for professional and enthusiast programmers.

This helped me solve the dates issue. – White Zebra May 15 '12 at 16:25
up vote 1 down vote accepted

There isn't a built-in method of saving saving the command history separately or by session. You would have to set your 'histfile' variable on a per-instance basis. This means you would need something unique in your environment that is present already when your .tcshrc file is sourced, or add code to yourself to the very top of your .tcshrc that finds some unique value, perhaps from the tty command.

Take care to only do this when you're in an interactive shell so that it won't unnecessarily slow down or complicate other things that spawn new tcsh shells that you might not expect. For example, if you're using vim and you execute any shell commands, the tty command won't behave.

I usually use the prompt3 method...

if ( $?prompt3 ) then
    # interactive-only things...

For a separate history, might be able to get away with something like:

set mytty = ( `tty` )
set histfile = ( ".history.${mytty}" )
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .