Skip to content
HomeVideosBooks
AllTopicsTrends
BlogsPodcasts
HistoryListsWatch laterLiked videosFollowing

The videos, books, blogs and podcasts Hacker News keeps recommending, all in one place.

VideosBooksBlogsPodcastsAboutPrivacySettings

Data from Hacker News, HackerTube, HackerBooks, HackerBlogs and Open Library. Credits · Not affiliated with Y Combinator.

HomeVideosBooksBlogsPodcasts
Ctrl K
    Cover of Learning the bash Shell

    Learning the bash Shell

    Cameron Newham, Bill Rosenblatt · 1995

    Learning the bash Shell, Third Edition, is the definitive guide to bash, the Free Software Foundation's "Bourne Again Shell." It's a freely available replacement for the UNIX Bourne shell, and is the shell of choice for users of Linux, Mac OS X, BSD, and other UNIX systems. You'll find this guide valuable whether you're interested in bash as a user interface or for its powerful programming capabilities. This book will teach you how to use bash's advanced command-line features, such as command history, command-line editing, and command completion. This book also introduces shell programming,a skill no UNIX or Linus user should be without. The book demonstrates what you can do with bash's programming features. You'll learn about flow control, signal handling, and command-line processing and I/O. There is also a chapter on debugging your bash programs. Finally, Learning the bash Shell, Third Edition, shows you how to acquire, install, configure, and customize bash, and gives advice to system administrators managing bash for their user communities. This Third Edition covers all of the features of bash Version 3.0, while still applying to Versions 1.x and 2.x. It includes a debugger for the bash shell, both as an extended example and as a useful piece of working code. Since shell scripts are a significant part of many software projects, the book also discusses how to write maintainable shell scripts.

    Systems & OSProgramming
    Open LibraryAmazon
    Stats for nerds
    2recommend
    6mentions
    6people
    2009–2017years
    33% recommend67% neutral

    Mentions per year

    200920102011201220132014201520162017

    What Hacker News says

    1. nikcubApr 2011
      The best way to learn the UNIX tools is in the context of shell scripting and using the combination of tools to achieve a purpose (such as parsing log files, setting up shortcuts as part of your dev toolchain)

      1. Understand the philosophy behind UNIX. ie. everything is a file and it is small apps that are very good at a single task that can be combined through pipes etc. to process larger tasks (this has lost its way somewhat in Linux, but still holds true)

      2. Look at your computer usage through development, sysadmin, etc. and find parts that you want to automate, and then set out to write scripts to complete these tasks. for eg. in each one of my projects I have a script called start.sh which has a bunch of tasks implemented (eg. backup, serve, dns (to update dyndns for callbacks), push, diff, deploy, stage (run remote commands) etc.). Remember that git is itself a set of shell scripts, as are most server management commands. Take a peak inside each of these to learn how they are implemented.

      3. Once you have a good understanding of what you want to implement, just go for it. Learn along the way by using Bash scripting, regular expressions, an understanding of UNIX/Linux, sed, awk, yacc/bison (to analyze code and extract info). You will end up building your own collection of shell scripts, environment variables, .vimrc, ssh, curl (you can do almost any API request and auth with curl and a shell script - automate tweets, RSS feeds) etc. (I have been meaning to publish my own, the most recent one I wrote greps my code for TODO's and pushes them to a simple webapp where I can view them, sort them, etc. along side my 'personal' todo list)

      4. You need two sets of resources, one is for learning, the other is for reference which you keep handy. Here are my own recommendations:

      Learning:

      The learning style book comes down a lot to personal preference. You can go wrong, so get a feel for each topic by reading online tutorials and then scan the TOC and sample chapters of books that look good. A subscription to O'Reilly Safari comes in handy. There are now also a lot of screencasts online, try searching YouTube for the topic with 'screencast' or 'tutorial', once you find a good screencast publisher look at the rest of his/her videos.

      You can also get the O'Reilly books on special in bundles sometimes, check their website

      There is no book that really introduces UNIX and then covers most of these topics as I described. ie. 'UNIX for Developers'.

      * UNIX:

      - FreeBSD handbook: http://www.freebsd.org/doc/handbook/

      - Linux Documentation Project: http://tldp.org/LDP/

      - Linux Command Line and Shell Scripting Bible: http://www.amazon.com/Linux-Command-Shell-Scripting-Bible/dp...

      - UNIX In a Nutshell (I haven't read this in a while but it is on my shelf): http://oreilly.com/catalog/9781565924277

      - Learning UNIX (also O'Reilly): http://www.amazon.com/Learning-UNIX-Operating-System-Fifth/d...

      * Bash:

      - http://linuxcommand.org/

      - http://bash.cyberciti.biz/guide/Main_Page (better, and v good)

      - Learning the Bash shell: http://oreilly.com/catalog/9780596009656/

      - Advanced Bash Scripting (online): http://tldp.org/LDP/abs/html/

      - YouTube playlist: http://www.youtube.com/view_play_list?p=2284887FAE36E6D8

      * Regular Expressions:

      - Mastering Regular Expressions (this is such a great book. I didn't like regexp until I picked this up eons ago): http://oreilly.com/catalog/9781565922570

      * sed/awk/grep etc.

      - sed & awk (O'Reilly): http://oreilly.com/catalog/9781565922259

      * Vim/Vi:

      - vimcasts (screencasts): http://vimcasts.org

      - more screencasts (these are great): http://vimeo.com/user1690209/videos

      - learning vi: http://www.amazon.com/dp/1565924266

      Reference:

      On my browser toolbar, I have a folder called '_ref', it has around 70+ bookmarks (online documentation, cheatsheats) in it each titled what the link is a reference for (ie. 'vi', 'bash' etc.). I will publish it online, and will post the links here. I have collected the links over years.

      thread
    2. etalMar 2009
      I like the O'Reilly book, Learning the Bash Shell:

      http://oreilly.com/catalog/9780596009656/

      I keep it on hand as a reference for shell scripting, since it's both thorough and fairly portable.

      thread
    3. jen729wJan 2017
      I realised I was guilty of this in 2016 so for 2017 I've made a few simple changes, the primary one being how I write my "project" name in OmniFocus.

      For instance, I had "Learn how to use bash properly". Well, what does that mean? When is that finished? It never is. Now, that project is called "Read 'Learning the bash shell'".

      Immediately, that's attainable. When I've finished reading the book, perhaps I'll want to do more, perhaps I won't. But at least I know that I'll have completed that project.

      thread
    4. orly_bookzNov 2016
      I'm no expert but have always found the O'Reilly books helpful.

      Also... well I'm not sure what HN's policy is on sources/linking but let's just say that you could search right now for "Classic Shell Scripting pdf" or "Learning the Bash Shell pdf" and find those fairly quickly online...

      thread
    5. combatentropyNov 2016
      Just to be clear the prices are not per book. I don't know if anyone else here stood dangerously long in that misunderstanding, almost preventing them from pulling the trigger. It's $1 for all the books on the first tier, $8 for all the books on the first and second tiers, or $15 for all of the books on the page. At first I was like, well maybe I'll get this book, this book, and that book. But then it was a no-brainer. In fact on the recommendation of a couple of posts here for DNS & Bind, I bought the whole hog.

      ---

        $1:
        Unix in a Nutshell (4th ed.)
        sed & awk (2nd ed.)
        lex and yacc (2nd ed.)
        Learning the bash Shell (3rd ed.)
        Linux Pocket Guide (3rd ed.)
      
        $8: (all of the above, plus)
        bash Cookbook
        Classic Shell Scripting
        Learning GNU Emacs (3rd ed.)
        Unix Power Tools
        Learning the vi and Vim Editors (7th ed.)
        Bash Pocket Reference (2nd ed.)
        Learning Unix for OS X (2nd ed.)
      
        $15: (all of the above, plus)
        Essential System Administration (3rd ed.)
        TCP/IP Network Administration (3rd ed.)
        DNS and BIND (5th ed.)
        Network Troubleshooting Tools
      thread
    6. telemachosNov 2010
      If you don't know it, I highly recommend learning about CDPATH as well. A good CDPATH means that directories you work in often are always easy to get to. (Add TAB completion in its latest version and they're even easier to get to.)

      http://www.caliban.org/bash/ (Under bash Tips and Tricks)

      One other good cd trick:

          # Shamelessly stolen from Learning the Bash Shell (3ed), Cameron Newham
          # & Bill Rosenblatt
          my_cd() {
              case "$#" in
                  0|1)
                      builtin cd $1
              ;;
                  2)
                      newdir=${PWD//$1/$2}
                      case "$newdir" in
                          $PWD)
                              echo "bash: my_cd: bad substitution" >&2
                              return 1
                          ;;
                          *)
                              builtin cd "$newdir"
                          ;;
                      esac
                  ;;
                  *)
                      echo "bash: my_cd: wrong arg count" 1>&2
                      return 1
                  ;;
              esac
          }
      
      The function allows you to do simple search/replace on your current working directory and cd to the replaced version, all in one step. This is a built-in ksh feature, but easy enough to enable in bash. If you have directories with relatively deep nesting and very similar names (e.g. school/2009-2010/compsci1/grades versus school/2010-2011/compsci2/grades), it's a godsend. An example:

          $ pwd
          /Users/telemachus/mmt/2010-2011/compsci2
          $ my_cd compsci2 compsci4
          $ pwd
          /Users/telemachus/mmt/2010-2011/compsci4
      thread

    Related

    Cover of Linux command line and shell scripting bible
    2011–2021

    Linux command line and shell scripting bible

    Richard Blum
    2 recommend · 4
    Advanced Bash-Scripting GuideMendel Cooper
    2011–2026

    Advanced Bash-Scripting Guide

    Mendel Cooper
    16 recommend · 33
    Cover of From bash to z shell
    2008–2019

    From bash to z shell

    Oliver Kiddle
    3 recommend · 6
    Cover of The UNIX programming environment
    2007–2026

    The UNIX programming environment

    Brian W. Kernighan
    86 recommend · 215
    Cover of Advanced programming in the Unix environment
    2008–2025

    Advanced programming in the Unix environment

    W. Richard Stevens
    100 recommend · 153
    Cover of Beginning portable shell scripting
    2017–2018

    Beginning portable shell scripting

    Peter Seebach
    2 recommend · 3
    Cover of UNIX Shell programming
    2014–2023

    UNIX Shell programming

    Stephen G. Kochan
    4 recommend · 6
    Cover of A Practical Guide to Linux Commands, Editors, and Shell Programming
    2017–2020

    A Practical Guide to Linux Commands, Editors, and Shell Programming

    Mark G. Sobell
    2 recommend · 3