Oh My ZSH will change your life.

My response was "Yeah, most webservices don't flush with a newline. You either have to deal with it or wrap a script around it or something." Then I realized that response was bullshit. Bash is a tool, and if the tool is annoying, you should find another tool. It's a computer. "Deal with it" is a crap response. So, I started digging over the weekend, looking for something better than Bash without a hugely steep learning curve. If you're not familiar with Bash (Bourne-Again SHell), then it's what you're using right now on your non-windows machine to interact with your command line. There are other shells, but Bash is the default on most all of them.
And it blows. Well, at least version 3 blows. Apparently version 4 is marginally better, but I'm not interested. ZSH is amazing, AND it uses the same syntax as Bash, adding lots more to it. And before I launch into why you should switch, let me just throw you a screenshot:

I put this prompt together over the weekend. It's worth noting, here, that you can coerce Bash to have a prompt similar to that, but not only is it easier in ZSH, there are other features we'll be getting to
So what you see up there is, first, a blank line (yes, it takes up space, but makes the separation of commands wonderfully obvious). On the next line, you have your username and hostname, and in this case my hostname is yellow to draw attention to the fact that I'm SSHed into a remote machine. Then the path, which is nothing special, then PURE FREAKING AWESOMENESS: The SHA of the HEAD of the git repo I'm in, the branch I'm in, and a little indicator that tells me if I have uncommitted changes. And if I'm on a branch that I'm tracking on a remote repo (like github) there would be a little yellow lightning bolt whenever I have committed changes I haven't pushed. ...And then the time, which is great when you're looking back through old commands.
Line 2, that arrow turns red when I'm root.

And that's just my own custom theme. There are a million more if you prefer a one-line prompt, or a different look and feel. Check some out here if you're interested.
What other cool shit do I have? Here's a list. Again, yes, Bash can be coerced to do some of these things, but in most cases ZSH can do this right out of the box or with a simple config switch:
- You know how you can hit <tab><tab> in Bash to see all the possible completions? ZSH gives you a list you can navigate with arrow keys:

- Press the up arrow to go back through your command line history. Big whoop, right? Now type 'ssh' and press the up arrow, and navigate through your history of commands starting with 'ssh'. That works with anything.
- Type a super long command. Realize you need to go back to the beginning. Don't you dare hold down the left arrow key for 5 minutes. Instead, realize you're using fucking VI. Hit ESC, and now you're in command mode. Capitol 'I', and now you're inserting at the beginning of the string. Hit slash and you can search for a substring and jump to it. It's VI. Use it to edit your command.
- Ever try to run a command from your history and realize you're boned because you ran that command in a different terminal session? ZSH shares history among sessions. This is no longer an issue.
- Built-in pagination. Type < then a filename and bam, easy reading. Sure, you could do
cat filename | less
, but save yourself the keystrokes! - That issue above with the output ending up on the same line as the next prompt? Thing of the past. ZSH detects that and throws an inverted % after the output to let you know there was no newline. Then it puts in a newline.
- So, so much more stuff, but I'm sick of listing it.
So here's what up. This dude decided it would be cool to build a theme and plugin framework around ZSH. He calls it Oh My ZSH. It's awesome, and will make your zsh life so much easier. Install it by running this at your Bash prompt:
curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh
Now edit ~/.zshrc to choose your theme and add plugins. I'm especially fond of 'nyan'. But definitely, definitely add 'git' if you use git. There are a million other useful ones too.
Enjoy






Cartoon Clouds
Mountains
Sunrise
Clouds
Green Clouds
None























Help