4

I was wondering: If I type history I can see the previous commands I typed and see what happened and perhaps keep commands as reference. But I don't know in which directory I was when I typed the commands.

Is there a version of history that displays also the directory you were in when you typed the command?

  • 3
    You may find this helpful: stackoverflow.com/q/945288/2100043 – BriGuy Jul 9 '13 at 20:54
  • 1
    Per-directory history in zsh may be interesting, if you're ok with switching to zsh. – Gilles Jul 9 '13 at 21:07
  • @Gilles:I have never used zsh.Is it separate download?Does it work ok with screen or tmux? – Jim Jul 9 '13 at 21:20
  • @Jim It's a separate program. Most distributions offer it as a package. Zsh is less common, often not part of the default installation, but has more features. The basic syntax is mostly the same, but some advanced features are different, and zsh has more. The two work equally well in screen or tmux. – Gilles Jul 9 '13 at 21:32
2

Following the link about Per-directory history in zsh and then the link in the comment there, two Per-directory history in bash links are provided (one is broken, but corrected here):

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.