Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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?


share|improve this question

4 Answers 4

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

share|improve this answer
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.

share|improve this answer

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.

share|improve this answer
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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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