summaryrefslogtreecommitdiff
path: root/cmd/changing-shells.txt
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/changing-shells.txt')
-rw-r--r--cmd/changing-shells.txt73
1 files changed, 73 insertions, 0 deletions
diff --git a/cmd/changing-shells.txt b/cmd/changing-shells.txt
new file mode 100644
index 0000000..47921b9
--- /dev/null
+++ b/cmd/changing-shells.txt
@@ -0,0 +1,73 @@
+## Why You're Going to Change Your Shell to Zsh
+
+Wait, we just got the Terminal app open and now you want to go and change the shell, WTF?
+
+The reason many people give up on the command line isn't because the command line is overly difficult, it's because they're slower using it than they are using GUI apps.
+
+You've been using Photoshop for so long you know all the helpful keyboard shortcuts you need to work deficiently. The same is probably true of your favorite text editor and everything else you use regularly.
+
+In order to get you working much more quickly in the terminal we need to get a shell that has the equivalent of powerful keyboard shortcuts.
+
+We need Zsh.
+
+Zsh is going to make navigating the command line much faster and easier, especially when you're first starting out.
+
+The biggest help Zsh provides is auto-complete on steroids.
+
+The most time consuming thing you'll do on the command line is type out paths and commands. Sure, `cd` is much faster to type than `change-directory`, but you still need to type the full path to the directory you want to change to. Unless you have Zsh.
+
+Here's an animated gif showing me navigating from my home directory to /var/www where I keep the sites on my server:
+
+[! tk animated gif of var www change]
+
+There isn't much Zsh can't auto-complete. If you install the pre-built package Oh-My-Zsh -- which I'll show you how to do in the next section -- you'll be able to auto-complete everything from paths to command options, even git commands.
+
+For example, I tend to have a lot of symlinks on my servers and I like `ls` to show me the actual path when there's a symlink, but I can never remember what the flag is for that so I just type `ls -` and then hit `tab` and Zsh helpfully gives me a list of options (in this case the flag I want is `-L`:
+
+![tk screen of ls - flag complete]
+
+Another great feature of Zsh is spelling corrections. We'll be typing commands like `ls` (list all the files and folders in the current working directory) and `cd` (change directory, AKA move to a new folder) a lot and you will inevitably accidentally type `dc` or `sl` followed by some long path. Rather than make you retype the whole thing, Zsh will simply ask, did you mean `ls`? Type a 'y' for yes the Zsh will run the command as `ls`.
+
+All of the examples in this book and screenshots are done in Zsh. The Z shell is perhaps best thought of as Bash improved. Technically it was derived from the Korn Shell, but for the most part it's a drop in replacement for Bash. There are differences, but for now you can ignore them -- if it works in Bash, it'll work in Zsh.
+
+## Install and Change to Zsh
+
+Okay let's install Zsh and make it our default shell. If you're on OS X and you've already got homebrew installed just type:
+
+ brew install zsh
+
+Ubuntu/Debian users can use:
+
+ apt-get install zsh
+
+If you're on Windows, using Cygwin:
+
+ apt-cyg install zsh
+
+That gets Zsh installed, now we need to make it the default so that we always start in a Z shell when we open a new terminal window. On OS X and Linux you can use this command:
+
+ chsh -s $(which zsh)
+
+For Windows/Cygwin head to C:/cygwin/Cygwin.bat and open that file in a text editor. Look for the line:
+
+ cygwin\bin\bash --login -i
+
+and change it to:
+
+ cygwin\bin\zsh -l -i
+
+Now you just need to log out and log back in and you'll have Zsh set up.
+
+## Installing Oh-My-Zsh
+
+Zsh is our default shell now, that's a good start but we're going to go a step further and set up a wonderful set of tools that goes by the name [Oh-My-Zsh]().
+
+Oh-My-Zsh is, in it's own words, "community-driven framework for managing your zsh configuration. Includes 180+ optional plugins (rails, git, OSX, hub, capistrano, brew, ant, php, python, etc), over 120 themes to spice up your morning, and an auto-update tool so that makes it easy to keep up with the latest updates from the community."
+
+Basically it give you a lot of powerful tools that with some sane configuration files.
+
+To install Oh-My-Zsh you can just paste this line in your terminal:
+
+ wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O - | sh
+
+If you'd like to play around with Oh-My-Zsh and try some different configurations, be sure to read through [the documentation](https://github.com/robbyrussell/oh-my-zsh) on GitHub. For now we'll just stick with the defaults that Oh-My-Zsh set up for us.