Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I normally works on Windows machines but on some occasions I do switch to development on linux. And my most recent project will be written entirely on a certain linix platforms (not the standard Apache/MySQL/PHP setup). So I thought it would pay to learn to write some linux automation script now.

I can get around the system, start/stop services, compile/install stuffs fine. Those are probably basic drills for a programmer. But if, for example, I wanted to deploy a certain application automatically to a newly minted linux machine every month I'd love to know how to do it.

So if I wanted to learn serious linux shell scripting, what book should I be reading?


locked by HopelessN00b Jan 12 '15 at 16:52

This question exists because it has historical significance, but it is not considered a good, on-topic question for this site, so please do not use it as evidence that you can ask similar questions here. This question and its answers are frozen and cannot be changed. More info: help center.

closed as off-topic by HopelessN00b Jan 12 '15 at 16:52

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

online: ABS

warning: this is a bash tutorial so there are bash-only syntaxes and I recommend you to not use them.

It is though a very good documentation

Why not use bash only syntax? I've never encountered a system that doesn't have /bin/bash installed. You just have to make the shebang line appropriately #!/bin/bash – Aaron Brown Dec 9 '09 at 18:45
@ABrown: Up until quite recently it was very common for linux rescue modes to use ash, and very small distribution also tend to use stripped down shells like the busybox sh. – dmckee Jan 29 '10 at 18:54

Learning the Bash Shell along with Classic Shell Scripting, followed by Bash Cookbook.

I would suggest charging through the first two books, without worrying too much about remembering it all. Reference them as you want to do something that you remember reading about but don't recall how to actually do. And come back to them a few a months later and learn new things from them.

Note, this is coming from the perspective of a linux admin, so I lean toward the niceties of bash over the more pure sh. It is only the rare script that I bother to actually make sh compatible. Also, I don't consider tcsh to be a legitimate scripting language.


Shell scripting is not shell scripting. Different systems come with different shells and the differences in syntax and semantic are significant.

Others have mentioned Bash books, for Korn shell I recommend O'Reilly's Learning the Korn Shell. If you'll have to write portable shell scripts there is also from O'Reilly: Classic Shell Scripting.

In my opinion: Writing portable shell scripts is a sheer nightmare even for people that are fairly used to a certain shell. If you come from a windows background, you are familiar with the basic stuff (start/stop services, compile/install stuffs) and your goal is automation I'd personally stick with Perl.

While Perl has its flaws it is when it comes to glueing different parts together where it shines. And this is what makes up most part of automation in my experience. Moreover, on Unix systems Perl is ubiquitous.

I see, I'll try some Perl s along the way :) – chakrit Dec 8 '09 at 22:47

I bought the amazon five star rated 'Linux Command Line and Shell Scripting Bible' from Richard Blum (ISBN: 047025128X) for getting to that 'serious shell scripting' and I must say I am very impressed by the book. Gives you in depth knowledge about shell scripting but also other concepts needed in that context like how linux file system permissions work and your must-known Unix tools like grep.


Not the answer you're looking for? Browse other questions tagged or ask your own question.