Skip to main content
Footer-logo Logo-white
Products
Platform
Technology
Ai content writing
AI Content Writing
Efficient AI-powered content generation.
Smart content brief
Smart Content Brief
AI-driven SEO content outlines.
Headline generator
Headline Generator
Attention grabbing headlines, in seconds.
Scripted analytics
Scripted Analytics
Analyze content performance easily.
Scripted for teams
Scripted for Teams
Collaborate with in-house and freelancers writers
Products
Blog posts
Blog Posts
High-quality, SEO-friendly posts.
Webpage
Web Pages
Engaging pages to boost traffic.
Webpage
Content Tune Ups
Revitalize your existing content.
Ebook
Ebooks
Drive engagement with detailed ebooks.
Workflow
Keyword research
Keyword Research
Analyze conversion rates.
Content strategy
Content Strategy
Plan your content journey.
Content creation
Content Creation
Manage and oversee content production.
Publishing
Publishing
Simplified, effective content publishing.
Performance
Performance
Track and refine content for better results.
Talent Network
Find writers
Find Writers
Browse our SME content writers.
Hire writers
Hire Blog Writers
Professional writers for your blog.
Hire ebook writers
Hire Ebook Writers
Access top-notch ebook writers.
Become writer
Become a Writer
Join our talent network.
Ready to get started? Sign up for free
Pricing Chat with sales
Solutions
By Business Type
Enterprise
Enterprise
Scalable business solutions.
Agency
Agencies
High-quality content partners.
Smb
SMBs
Empowering SMB growth.
By Industry
SaaS
Streamline your messaging.
ABM
Drive ABM with great content.
E-Commerce
Amplifying your e-commerce presence.
Media Publishers
Enhancing media publishing outcomes.
Resources
Scripted Blog
Read our latest posts.
Glossary
Understanding content marketing terms.
AI Philosophy
Our AI-driven approach explained.
AI Resources
Everything we know about AI.
Ready to get started? Sign up for free
Pricing Chat with sales
Plans 1 (866) 501-3116 Log in Get Started
Menu button
x Close Menu Products Platform
Technology
Ai content writing
AI Content Writing
Efficient AI-powered content generation.
Smart content brief
Smart Content Brief
AI-driven SEO content outlines.
Headline generator
Headline Generator
Attention grabbing headlines, in seconds.
Scripted analytics
Scripted Analytics
Analyze content performance easily.
Scripted for teams
Scripted for Teams
Collaborate with in-house and freelancers writers
Products
Blog posts
Blog Posts
High-quality, SEO-friendly posts.
Webpage
Web Pages
Engaging pages to boost traffic.
Webpage
Content Tune Ups
Revitalize your existing content.
Ebook
Ebooks
Drive engagement with detailed ebooks.
Workflow
Keyword research
Keyword Research
Analyze conversion rates.
Content strategy
Content Strategy
Plan your content journey.
Content creation
Content Creation
Manage and oversee content production.
Publishing
Publishing
Simplified, effective content publishing.
Performance
Performance
Track and refine content for better results.
Talent Network
Find writers
Find Writers
Browse our SME content writers.
Hire writers
Hire Blog Writers
Professional writers for your blog.
Hire ebook writers
Hire Ebook Writers
Access top-notch ebook writers.
Become writer
Become a Writer
Join our talent network.
Solutions
By Business Type
Enterprise
Enterprise
Scalable business solutions.
Agency
Agencies
High-quality content partners.
Smb
SMBs
Empowering SMB growth.
By Industry
SaaS
Streamline your messaging.
ABM
Drive ABM with great content.
E-Commerce
Amplifying your e-commerce presence.
Media Publishers
Enhancing media publishing outcomes.
Resources
Scripted Blog
Read our latest posts.
Glossary
Understanding content marketing terms.
AI Philosophy
Our AI-driven approach explained.
AI Resources
Everything we know about AI.
Plans
1 (866) 501-3116
Log in Get Started
  1. Blog Home
  2. Development
  3. Sylvain Niles
  4. Bash is dead... Long live ZSH!

Bash is dead... Long live ZSH!

Over the years I've flirted with several different shells. During the 80's on System V I used csh, later I spent years working on Solaris in tcsh (oooh tab completion!), but as Linux became the main operating system of choice I switched to bash. It seemed like a good choice at the time, as it has several nice features and is the default on most systems, including OS X. However, it wasn't long until I started noticing the cool new kid on the block: zsh.

I admit, I was originally interested in zsh because of the flashy command prompt I saw co-workers using-wow is that really your laptop battery life displayed as hearts from zelda in the command prompt??-but once I dove in I found all sorts of awesome stuff!

Recursive Globbing


How many times have you been looking for a file but can't remember where in your home dir it's stored? You can resort to the find command, but it's clunky and not very intuitive. Instead with zsh, you can find it quickly and efficiently:
+-@Sylvains-MacBook-Pro.local ~/temp


+- ls -la **/*.txt

-rw-r--r-- 1 sylvain staff 0 Sep 17 17:31 1.txt

-rw-r--r-- 1 sylvain staff 0 Sep 17 17:31 2.txt

-rw-r--r-- 1 sylvain staff 0 Oct 1 13:49 baz/foo/file_im_looking_for.txt


Suffix Aliasing


In GUI interfaces like Windows or OS X you have the ability to double click on a file in order to launch the appropriate application to open that file with. In zsh you can instead set suffix aliases to accomplish something similar:
alias -s rb=vim

Now from my shell I can just type:
~/temp/sample.rb

And voila, vim will launch and edit the file.

Hash Support


If you do a lot of development in ruby and its compatriots, you've probably come to rely on hashes as a very versatile data structure. After all, being able to work with them in your shell scripts makes them much more powerful and allows you to more intuitively aggregate data instead of having to set up large number of accumulator variables. Additionally you're able to do things like list all the keys and/or values in the hash, something you can't do in bash without knowledge of all the variables and explicitly calling each one.

Sexy Command Prompts


I gave you a little teaser earlier but there's so much more to zsh's command prompt structure. There's even a built in theming system if you're using oh-my-zsh, allowing you to quickly try out a wide variety of prompts. I modified gnzh to suit my purposes, here's some examples of why it rocks:

+-@Sylvains-MacBook-Pro.local ~

+- cd dev/zsh-battery

+-@Sylvains-MacBook-Pro.local ~/dev/zsh-battery (master*)

+- touch some-file.rb

+-@Sylvains-MacBook-Pro.local ~/dev/zsh-battery (master[?])

+- rm some-file.rb

+-@Sylvains-MacBook-Pro.local ~/dev/zsh-battery (master*)

+-


Unfortunately I can't show you the color changes (aside from the snippet appearing in this piece's featured image), but I can note the key take aways. For example, my command prompt changes to green when I'm in a git project and displays the branch I'm working with. If my working directory isn't clean, then the green * after the branch name turns into a red [?] until I've committed or cleaned up my working directory.

Tab Completion...For Anything


Perhaps the most impressive part of zsh is how many plugins are available to support context aware tab completion. The git plugin is an awesome example. Start typing git check and hit tab, you'll get checkout. Then start typing a branch (or remote!) name and it will tab complete from the available options! This allows me to write very descriptive branch names like fix_admin_invisibility_bug without paying the penalty of typing that out each time I'm going to work on the branch.

Have you found an even better way to utilize zsh in your day-to-day? Leave a comment and let me know!

Published by Sylvain Niles on Monday, October 8, 2012 in Development, Bash, Command Prompts, Development, Zsh.

Sign Up For Your 30 Day Free Trial Today!

You agree to Scripted’s Terms of Use and Privacy Policy.
Already have an account? Login
Footer-logo
©2011-2023
Our Company
About Us Privacy Terms of Use GDPR Trust
For Members
Enterprise Agencies Publishers Customer FAQs Customer Sign In
For Writers
Writer Services Agreement Writer FAQs Writer Sign In
Additional Resources
The Scripted Blog Industries Technology Competitors AI Content Writing
Social Buttons