Learn Linux with the Linux Cookbook

For those of you wishing to become competent at the command line in Linux, this is a good value book that has plenty of 'recipes' that will teach you the basics of a wide range of command line tools and how to combine them to greater effect. The Linux / GNU philosophy or approach is to re-use existing tools as building blocks for more complex tasks rather than completely re-inventing the wheel for each new task. The book also has sections on X-Windows, Sound and Images but again has an emphasis on the command line. The book was written in 2001 but the tools haven't changed so it stands the test of time... While the book does not go into depth on Shell Scripting, it gives the basics on how to write a shell script and gives you lots of tools that you could use in shell scripts to automate tasks etc. What it lacks in this regard is an introduction to the various programming constructs available to the shell such as if statements, while statements and so on. But there are many such resources available on line - more in a later post... The good thing is that you don't have to commit to buying the book before you try it - a free version of the book is available to browse online at: http://dsl.org/cookbook/cookbook_toc.html Happy Learning!!


The Linux Documentation Project have a great guide to Bash scriptingThe guide starts from the beginning with how environment variables are set and accessed through looping and conditional branching, subroutines, a quick guide to regular expressions.

Another great guide is the Unix Power Tools from O'Reilly which covers the use of all the filter programs you might use in a shell script.

And if you doubt the utility of the shell in these days of mouse driven windowing environments let me ask how you would achieve the following with a mouse?

[email protected]:~/$ for i in $(find ./ -name \*.txt)
> do cp $i \ ${i%.txt}.bak
> done

The above command will create a backup of every text document in the current folder and any sub folders.

Finally a very cute analogy can be found in this article on power tools

Thanks for the illustration Phil. I'll include your link to the LDP Guide in a later post - or maybe you'd like to write that post yourself?

And to elaborate on your example - let's say you have 100 different text files in 20 sub-directories...

With a mouse, we're talking up to an hour in time and several other costs: repetitive strain on wrist and brain; some form of winding down after such an incredibly boring task and so on... Often the task will get left undone.

With a basic knowledge of shell scripting, it takes a matter of seconds. Priceless!!

Brian :)

Hi Brian,

I have a little time off over the Christmas and may as well do something useful, what is the scope and audience of the post you are looking for?

I have a bash overview document I cobbled together from various sources (multiple sources is research), and some original material. It covers bash usage, tab completion, emacs keys on the command line, ~/.bash*, common environmental variables and a quick overview of scripting(ie, vars, branching, looping ).

It doesn't cover sed, awk, expr or lots of other useful tools that every script writer should know. It also fails to mention man, apropos and so on, perhaps I might expand it to include these and post it?