Since this post got quite popular I decided to incorporate some of the excellent suggestions posted in the comments, so this list now has more than 50 books in it. BTW: I’m not very strict on the definition of “ebook”, some of them are really just HTML versions of books. [UPDATED: 2012-01-18]
Learning a new programming language always is fun and there are many great books legally available for free online. Here’s a selection of 30 of them:
Lisp/Scheme:
Common Lisp: A Gentle Introduction to Symbolic Computation
How to Design Programs
Interpreting Lisp (PDF, suggested by Gary Knott)
Let Over Lambda
On Lisp
Practical Common Lisp
Programming in Emacs Lisp
Programming Languages. Application and Interpretation (suggested by Alex Ott)
Simply Scheme: Introducing Computer Science (suggested by Peter Aronoff
Successful Lisp: How to Understand and Use Common Lisp (suggested by Juanito)
Structure and Interpretation of Computer Programs
Teach Yourself Scheme in Fixnum Days
Ruby:
The Bastards Book of Ruby (suggested by Dan Nguyen)
Clever Algorithms (suggested by Tales Arvelos)
Data Structures and Algorithms with Object-Oriented Design Patterns in Ruby
Learn Ruby the Hard Way
Learn to Program
MacRuby: The Definitive Guide
Mr. Neighborly’s Humble Little Ruby Book (suggested by tundal45)
Programming Ruby
Read Ruby 1.9
Ruby Best Practices
Ruby on Rails Tutorial Book (suggested by tundal45)
Javascript:
Building iPhone Apps with HTML, CSS, and JavaScript
Eloquent Javascript
Essential JavaScript Design Patterns For Beginners (suggested by Rajaseelan)
jQuery Fundamentals
Mastering Node
The Node Beginner Book (suggested by alessio alex)
Haskell:
Implementing functional languages: a tutorial
Learn You a Haskell for Great Good
Real World Haskell
The Haskell Road to Logic, Maths and Programming
Erlang:
Concurrent Programming in Erlang
Learn You Some Erlang for Great Good
Perl:
Beginning Perl
Higher-Order Perl
Impatient Perl
Modern Perl (suggested by Gregory Brown)
Python:
A Byte of Python (suggested by Raoul Snyman)
Dive Into Python
Dive Into Python 3 (suggested by Rajaseelan)
How to Think Like a Computer Scientist – Learning with Python
Invent Your Own Computer Games with Python (suggested by D)
Learn Python The Hard Way (suggested by Stephen Wyatt Bush)
Non-Programmer’s Tutorial for Python 3 (suggested by WMN Trivia)
Smalltalk:
Dynamic Web Development with Seaside
Pharo by Example (based on the next book in this list, suggested by Anonymous)
Squeak by Example
Misc:
A to Z of C (sugested by Kevin)
Algorithms
The Art of Assembly Language
Building Accessible Websites (suggested by Joe Clark)
The C Book
C# Yellow Book (suggested by Joe Wyatt)
Compiler Construction
Dive Into HTML 5 (suggested by @til)
The Implementation of Functional Programming Languages (suggested by “Def”)
An Introduction to R
Learn Prolog Now!
Learning Go
The Little MongoDB Book (suggested by Francesca Krihely)
The Little Redis Book (suggested by Juan Fatas Huang)
Objective-C 2.0 Essentials
Parsing Techniques (suggested by IronScheme)
Programming Scala
Smooth CoffeeScript
Starting FORTH
Type Theory and Functional Programming
This is far from comprehensive and languages that are completely missing are mostly left out on purpose (e.g. PHP, C++, Java). I’m sure somebody else made a list for them somewhere.