Learning Shell Scripting with Zsh
eBook - ePub

Learning Shell Scripting with Zsh

  1. 132 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Learning Shell Scripting with Zsh

Book details
Book preview
Table of contents
Citations

About This Book

In Detail

Zsh has become incredibly popular in recent times and reasonably so; the shell boasts some really great features such as command completion, filename generation, and history sharing among instances of the shell. Learning to use them to your advantage will prove to be really valuable and will save you from lots of tedious and overly-complex tasks.

This hands-on guide will show you how to configure and use zsh for work and daily tasks. It provides a clear introduction to the more powerful features of the shell such as globbing and completion. This book will help you take advantage of the real power behind the UNIX shell on both desktops and servers through real-world examples.

This book will help you understand the features of zsh and make it one of the most valuable assets in your toolbox. It will teach you how to use the shell history to look up and edit previously typed entries and take advantage of the line-editor module to speed up your typing and editing of commands. You will be able to create your own completion functions and ensure you never mistype a command or have to look at the manpages again.

You will learn how to define your own aliases and learn about filename generation so you can do more by typing even less. You will also discover the essentials of zsh and go deeper with its more advanced features. When you are done with this book, your time with the command line will be much more enjoyable and productive.

Approach

A step-by-step tutorial that will teach you, through real-world examples, how to configure and use zsh and its various features.

Who this book is for

If you are a system administrator, developer, or computer professional involved with UNIX who are looking to improve on their daily tasks involving the UNIX shell, "Learning Shell Scripting with zsh" will be great for you. It's assumed that you have some familiarity with an UNIX command-line interface and feel comfortable with editors such as Emacs or vi.

Frequently asked questions

Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Yes, you can access Learning Shell Scripting with Zsh by Gaston Festari in PDF and/or ePUB format, as well as other popular books in Computer Science & Programming in C. We have over one million books available in our catalogue for you to explore.

Information

Year
2014
ISBN
9781783282937
Edition
1

Learning Shell Scripting with Zsh


Table of Contents

Learning Shell Scripting with Zsh
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers and more
Why Subscribe?
Free Access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Getting Started
Installing zsh
Installing on Linux
Installing on OS X
Compiling from source
First run
Making zsh your login shell
Shell options
The startup files
The shell prompt
The prompt command
Customizing the prompt
Using escape sequences
Shell state options
Login information options
Directory options
Date and time options
Text formatting options
Conditional expressions
Putting it all together
Summary
2. Alias and History
Working with aliases
Quoting characters
Single and double quoting aliases
Global aliases
Hashes
Putting it all together
Expansion
Parameter expansion
Command substitution
Arithmetic expansion
Brace expansion
Working with history
History expansion
History substitution
More useful options
Summary
3. Advanced Editing
Zsh line editor
Getting to know ZLE
Working with keymaps
Basic editing
Going back and forth with words
Yanking and transposing text
Revisiting history
Advanced editing
ZLE-related options
Defining your own keymaps
Don't call them widgets
Defining your own widgets
Special variables
Your first function
Working with regions
Multiline editing
Putting it all together
Summary
4. Globbing
Quoting your strings
Double quotes
Getting started with Globbing
Globbing with the stars
Questions for any single character
Brackets for a sequence of characters
Using safer ranges on your scripts
Avoiding characters
Handling mismatches
Extended Globbing
Special patterns
Recursive searching
Alternate patterns
Numeric ranges
Revisiting the caret operator
The tilde operator
Glob qualifiers
Timestamp qualifiers
File size qualifiers
The zmv function
Summary
5. Completion
Getting started with completion
Getting assertive with zstyle
Command correction
Completers
Ignoring matches
Function definitions
The path of the function
Summary
6. Tips and Tricks
Main resources
Helping tips
Directory substitution
Magic space
Random numbers
zcalc
Change and list directory contents
Finding your path through commands
Other projects
zsh-lovers
zsh-users
oh-my-zsh
Prezto
Explain Shell
Your dotfiles
Summary
Index

Learning Shell Scripting with Zsh

Copyright © 2014 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: January 2014
Production Reference: 1080114
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78328-293-7
www.packtpub.com
Cover Image by Aniket Sawant ()

Credits

Author
GastĂłn Festari
Reviewers
Takeshi Banse
Alice Ferrazzi
Chien-Wei Huang
Acquisition Editor
Rubal Kaur
Commissioning Editor
Govindan K
Technical Editors
Nikhil Potdukhe
Tarunveer Shetty
Copy Editors
Dipti Kapadia
Kirti Pai
Project Coordinator
Aboli Ambardekar
Proofreader
Bridget Braund
Indexer
Hemangini Bari
Production Coordinator
Alwin Roy
Cover Work
Alwin Roy

About the Author

GastĂłn Festari is a scripting language enthusiast with over five years of experience and a firm believer in free, open source software. Currently working as a developer for Globant, he likes to spread the word about zsh at different meetups and events when away from the keyboard.

Table of contents

  1. Learning Shell Scripting with Zsh