Zsh: The last shell you will ever need
friedcpu.wordpress.com
friedcpu.wordpress.com
shopt -s histappend
export PROMPT_COMMAND='history -a'
The histappend option appends to history instead of overwriting. PROMPT_COMMAND is run before bash displays a prompt -- this will save each command right after you issue it, instead of when you exit the session.Now that your history is about to get a lot larger, you'd probably want to override the defaults for HISTSIZE and HISTFILESIZE.
Somewhat OT, but since I mentioned PROMPT_COMMAND: One very useful piece of info to have in your prompt is the exit status of your last command. You can do that with
export PROMPT_COMMAND='ERRVAL=$?; history -a'
Then just include ${ERRVAL} in your PS1.Every so often this really bites me, but the usefulness far outstrips the quirks.
My solution for my laptop has helped me on countless occasions. I've been doing this for about three years.
1. Compile bash with the syslogger patch. Each command will generate one line with timestamp, username, terminal PID, and command.
2. Configure syslog to pipe all bash commands to a special file.
3. Run a cronjob every night that takes all the bash commands from the day and saves them off to a day specific file.
4. Need to find that command you ran 6 months ago to get package XYZ to work in way ABC? Use "grep -R" to find every single invocation you ever made to that program. If you actually needs a particular shell's local history, pipe grep through a grep for the PID (I find I almost never need that).
I work with so many different technologies for such brief times that this is just absolutely invaluable. It also helps you narrow down dates of events sometimes.
For installation, use google etc. but here: http://blog.rootshell.be/2009/02/28/bash-history-to-syslog/
Gentoo users can reinstall with the 'bashlogger' USE flag.
export HISTIGNORE="&:ls:ls -la"
That will ignore duplicates, "ls", and "ls -la"That's for local shell history, I also record every command to a file based archive (see my other comment in this thread: http://news.ycombinator.com/item?id=992772 ).
Honestly I'd like to see a shell with less programming features, not more. It should be hella tuned for command line usability, but I don't give a damn if it has a while loop.
The bigger question is, what is the switching cost?
If you haven't already, try copying your .profile to .zshrc (just to see if it works); only your login shell reads your .profile.
zsh might not be the last shell you ever need. Have a look at the friendly interactive shell: http://fishshell.org/ It looks really nice. But I too, have not yet replaced my beloved zsh.
But I'm interested in the point of view of people thinking that twitter would be a better place to share that kind of stuff.
http://naleid.com/blog/2009/05/13/shared-zshrc-file/
The repo to clone is on bitbucket:
bindkey '^r' history-incremental-search-backward
I suggest to look for a .zshrc file, the article has a good one linked.