why Z shell (zsh) is cooler than your shell Brendon Rapp - Cave Lunch #1

Similar documents
Unit 10 : An Introduction to Linux OS

Cisco Networking Academy Program Curriculum Scope & Sequence. Fundamentals of UNIX version 2.0 (July, 2002)

Basic C Shell. helpdesk@stat.rice.edu. 11th August 2003

Beginners Shell Scripting for Batch Jobs

PrimeRail Installation Notes Version A June 9,

A Crash Course on UNIX

Fred Hantelmann LINUX. Start-up Guide. A self-contained introduction. With 57 Figures. Springer

Linux command line. An introduction to the Linux command line for genomics. Susan Fairley

Cisco Setting Up PIX Syslog

Tutorial 0A Programming on the command line

HP-UX Essentials and Shell Programming Course Summary

The Linux Operating System and Linux-Related Issues

The Linux Operating System

Unix Shell Scripts. Contents. 1 Introduction. Norman Matloff. July 30, Introduction 1. 2 Invoking Shell Scripts 2

Unix Sampler. PEOPLE whoami id who

LSN 10 Linux Overview

Outline. Unix shells Bourne-again Shell (bash) Interacting with bash Basic scripting References

A Brief Introduction to the Use of Shell Variables

User's Manual. Intego VirusBarrier Server 2 / VirusBarrier Mail Gateway 2 User's Manual Page 1

Tour of the Terminal: Using Unix or Mac OS X Command-Line

Configuring LocalDirector Syslog

AN INTRODUCTION TO UNIX

Lab 1: Introduction to C, ASCII ART and the Linux Command Line Environment

Linux System Administration on Red Hat

Setting up PostgreSQL

CS 103 Lab Linux and Virtual Machines

Lecture 4: Writing shell scripts

Command Line - Part 1

CONNECTING TO DEPARTMENT OF COMPUTER SCIENCE SERVERS BOTH FROM ON AND OFF CAMPUS USING TUNNELING, PuTTY, AND VNC Client Utilities

Shell Scripts (1) For example: #!/bin/sh If they do not, the user's current shell will be used. Any Unix command can go in a shell script

Upon completion of this chapter, you will able to answer the following questions:

TNM093 Practical Data Visualization and Virtual Reality Laboratory Platform

Hands-On UNIX Exercise:

An Introduction to the Linux Command Shell For Beginners

PROGRAMMING FOR BIOLOGISTS. BIOL 6297 Monday, Wednesday 10 am -12 pm

What will be supplied with chemoventory package?

VMware Server 2.0 Essentials. Virtualization Deployment and Management

Unix the Bare Minimum

A UNIX/Linux in a nutshell

UNIX, Shell Scripting and Perl Introduction

This presentation explains how to monitor memory consumption of DataStage processes during run time.

Installing C++ compiler for CSc212 Data Structures

Parallels Desktop for Mac

UNIX / Linux commands Basic level. Magali COTTEVIEILLE - September 2009

EMC Avamar. Backup Clients User Guide. Version REV 02

EMC AVAMAR BACKUP CLIENTS

Version Control with Subversion and Xcode

Operating Systems compatible with GigasoftOBM / GigasoftACB (Supported Operation System List):

Shellshock Security Patch for X86

Bash Guide for Beginners

Understanding the OS Architecture and Linux History. Zhiqiang Lin

SFTP SHELL SCRIPT USER GUIDE

CSE 265: System and Network Administration. CSE 265: System and Network Administration

Introduction to Shell Scripting

How to Install and Run Tibia on Linux Using Wine without Windows Contents

Click Start > Control Panel > System icon to open System Properties dialog box. Click Advanced > Environment Variables.

REXX-like Macro Language for UNIX and Windows

IBM WebSphere Application Server Version 7.0

PKZIP 6.0 Command Line Getting Started Manual

SAP HANA Client Installation and Update Guide

Distributed Version Control

Web Hosting: Pipeline Program Technical Self Study Guide

Introduction to UNIX and SFTP

INASP: Effective Network Management Workshops

Installing HSPICE on UNIX, Linux or Windows Platforms

AES Crypt User Guide

CSIL MiniCourses. Introduction To Unix (I) John Lekberg Sean Hogan Cannon Matthews Graham Smith. Updated on:

CSE 265: System and Network Administration. CSE 265: System and Network Administration

Lecture 1: Introduction to UNIX

Professional. SlickEdif. John Hurst IC..T...L. i 1 8 О 7» \ WILEY \ Wiley Publishing, Inc.

SEO - Access Logs After Excel Fails...

CloudBackup Installer Guide Linux. System Requirements. Get Started - Linux

TECHNICAL SKILLS UNIX, UNIX-like including Solaris, Linux, Mac OS X, BSD, SySVr4, HP-UX

SellerDeck. IIS6 Setup Guide. Detailing the setup Windows 2003 (IIS6) Server

Symantec ApplicationHA Agent for WebSphere Application Server Configuration Guide

Snap Creator Framework 4.1.1

Solaris Run Cron Job Every 5 Minutes

CS 377: Operating Systems. Outline. A review of what you ve learned, and how it applies to a real operating system. Lecture 25 - Linux Case Study

TIBCO Enterprise Administrator Release Notes

Operating System Structure

ICS 351: Today's plan

Introduction to Open Source. Marco Zennaro Carlo Fonda

Network Monitoring Tool with LAMP Architecture

Introduction to Shell Programming

12 Most Important Unix Commands You Should Know

AWK: The Duct Tape of Computer Science Research. Tim Sherwood UC Santa Barbara

ZABBIX. An Enterprise-Class Open Source Distributed Monitoring Solution. Takanori Suzuki MIRACLE LINUX CORPORATION October 22, 2009

DS License Server V6R2013x

Wakanda Studio Features

2015 Exelis Visual Information Solutions, Inc., a subsidiary of Harris Corporation

CS 2112 Lab: Version Control

PGP Command Line Version 10.0 Release Notes

Introduction to Operating Systems

Introduction to Linux operating system. module Basic Bioinformatics PBF

Using ORACLE in the CSLab

CE 504 Computational Hydrology Computational Environments and Tools Fritz R. Fiedler

Laboratory Report. An Appendix to SELinux & grsecurity: A Side-by-Side Comparison of Mandatory Access Control & Access Control List Implementations

SVNManager Installation. Documentation. Department of Public Health Erasmus MC University Medical Center

Transcription:

why Z shell (zsh) is cooler than your shell Brendon Rapp - Cave Lunch #1

why Z shell (zsh) is cooler than your shell (unless your shell is zsh) Brendon Rapp - Cave Lunch #1

(alternate title) she sells Z shells by the sea shore

Donald Knuth Professor Emeritus of Computer Science at Stanford Author of The Art of Computer Programming "Father of algorithmic analysis" Creator of TeX

In 1986, Knuth was asked to write a guest feature for the "Programming Pearls" column in the Communications of the ACM journal. The task was to write a program that would: read a file of text, determine the n most frequently used words, and print out a sorted list of those words along with their frequencies.

Knuth produced a solution in Pascal that, when printed, was about 10 pages in length. It was well designed, thoroughly commented, and used a novel data structure for managing the word count list.

In response, Doug McIlroy wrote a shell script that produced the same output.

In response, Doug McIlroy wrote a shell script that produced the same output. McIlroy's script was six lines long.

Doug McIlroy's Shell Script tr -cs A-Za-z '\n' tr A-Z a-z sort uniq -c sort -rn sed ${1}q

A brief history of shells 1971: Thompson shell Ken Thompson, Bell Labs, first Unix shell interactive interpreter, not scripting environment 1977: Bourne shell scripting language Version 7 Unix, PDP-11 1984: The UNIX Programming Environment, Kernighan & Pike The shell of commercial Unixes System V, AIX, HP-UX, SCO, Solaris, SunOS Still the default on some of these (that are still alive) /bin/sh compatibility mode in modern shells symlink or hard link to compatible shells in modern Unixes

A brief history of shells 1978: C shell BSD Unix More "C-like" scripting syntax (kinda) Command history Aliasing tcsh - newer C shell, default on FreeBSD, and OS X systems 10.0-10.2 1983: Korn shell Bell Labs (AT&T) Proprietary until 2000 vi and emacs editing modes Lots of C shell features "middle road" between Bourne and C shell pdksh - default on OpenBSD

A brief history of shells 1989: Bourne Again shell (bash) GNU, GPL first legitimate Free shell (/bin/sh compatible) shells like ksh and csh became Free only much later on standard shell for Linux distros, Mac OS X 10.3+ TAB completion extended scripting syntax 1990: Z shell most closely resembles Korn shell /bin/bash compatibility, drop-in replacement for Bash "new" (despite being over 20 years old) awesome stuff I'll talk about next

Why use zsh?

First, a reason that's kind of lame...

If you're using Mac OS X...

... your Bash is old! (OS X 10.8.2... and many earlier OS X versions too)

OS X: GPL Wasteland no GPLv3 on OS X OS X bash: final version released as GPLv2 Homebrew has latest Bash (but many use situation as an excuse to try zsh instead)

Examples of Actual Zsh Awesomeness

zsh: cd completion

zsh: cd completion

zsh: cd completion

bash: cd completion

bash: cd completion

bash: cd completion

zsh: git completion

zsh: git completion

bash: git completion

bash: git completion It's possible to get completion for git (and many other commands) in Bash by installing bash-completion package, but the completion is still rudimentary compared to zsh: no cycling through options with repeated tabs no accompanying info with commands, just a list breaks to new prompt line on each tab instead of updating in-place There may be ways to improve that situation and bring it more in line with zsh, but with zsh, you get it basically out-of-the-box, with a single command in your.zshrc to enable completions.

zsh: path expansion (hit TAB, and then...)

zsh: path expansion (... the path is expanded in place, provided there is only one path matching that pattern)

zsh: path expansion (If there isn't only one distinct match for the pattern...)

zsh: path expansion (... the first TAB will expand up until it hits an ambiguity... )

zsh: path expansion (... the next TAB lists the possible matches... )

zsh: path expansion (... then TAB begins cycling through the possibilities... )

zsh: path expansion (... until you get to the one you want, and hit the Right arrow to "select" it... )

zsh: path expansion (... and then TAB resumes matching through the rest of the path)

bash: path expansion? (hit TAB... nothing)

zsh: path replacement (Whoops. I meant /usr/local/share)

zsh: path replacement

zsh: path replacement (no more "cd../../../")

bash: path replacement?

zsh: right prompt PROMPT (or PS1): left prompt (like bash) RPROMPT (or RPS1): right prompt!

zsh: right prompt

zsh: spelling correction

zsh: spelling correction

zsh: spelling correction

zsh: aliases Normal aliases: alias ls='ls --color=auto'

zsh: aliases Global aliases - appear anywhere in command string alias -g gp=' grep -i' % ps ax gp ruby => ps ax grep -i ruby

zsh: aliases Suffix aliases - "Open With..." alias -s rb=vim alias -s log="less -MN" alias -s html=chromium % user.rb => vim user.rb % development.log => less -MN development.log % index.html => chromium index.html

zsh: extended globbing Normal globbed search

zsh: extended globbing Extended globbed search: **/ = recursive

zsh: environment variable editing

zsh: programmable file renaming

zsh-history-substring-search Down arrow = cycle through command history

zsh-history-substring-search Type part of command and hit up arrow, cycle through only commands that begin with that string

zsh-syntax-highlighting Highlights valid commands in green, invalid commands in red Supports shell commands as well as executables in $PATH

oh-my-zsh

Other zsh bullet points Simple configuration style Shared history simple & fast, requires some monkeying to replicate in bash Lots of additions for shell scripting Output redirection to multiple destinations And, apparently, plenty of other stuff deeper than I've gotten so far.

The End Go 49ers