Monday, January 05, 2009

Recommendation for an Introduction to Unix

A regular blog reader asked me for recommendations on books to learn Unix, and which Unix to learn. I still remember asking my "Unix and Solaris Fundamentals" instructor in 1997 to recommend a book on Unix for me. I thought I would share my response here.

I think, as a beginner, you have to decide what you want to learn. I'll try to keep this description generic yet answer the reader's question. The person who asked the question requested an emphasis on the command line, rather than administration using GUIs.

As you might have guessed, I recommend trying FreeBSD. In fact FreeBSD 7.1 was released today. FreeBSD is a great OS for beginners, especially those who want to rely on the command line.

I am reluctant to suggest trying to learn a new OS without a good reference, but luckily a modern and thorough book arrived a little over a year ago. Michael Lucas' book Absolute BSD, 2nd Ed is probably the best pure introductions to Unix administration available. (I mean that of all the books out there, regardless of OS, Michael's book is the best, especially for beginners.)

Four years ago I posted reasons I like FreeBSD, if you want to see my overall thoughts on the OS.

After reading Michael's book, I suggest deploying services by reading Building a Server with FreeBSD 7
by Bryan J. Hong. Brian wrote a cookbook for building various servers on FreeBSD 7.x.

I don't recommend running FreeBSD on the desktop. I prefer my desktop to "just work," and I work in a GUI environment (although I tend to install software via command line anyway). I used to run FreeBSD on my laptop, but now I use Ubuntu. For me, Ubuntu "just works." I don't worry about anything. That's what I want in a more fluid environment like a desktop. PC-BSD is an option on the desktop, but I don't run it.

If you're more inclined to use Linux everywhere, then I suggest Debian on servers and Ubuntu on your desktop. The nice aspect of pairing these two is that Ubuntu is essentially Debian underneath. Ubuntu (or even Debian) is also more likely to be natively supported for many desktop applications, whereas FreeBSD might be a little less supported.


Richard Bejtlich is teaching new classes in DC and Europe in 2009. Register by 1 Jan and 1 Feb, respectively, for the best rates.

13 comments:

Brad said...

In addition, I'd like to throw my hat into the ring for OpenBSD. If you're going to learn Unix you may as well start from the perspective of one of the most secure Unix operating systems today (yes I said it, and already I regret it :).

Michael Lucas also wrote an absolutely fantastic book on OpenBSD entitled, you guessed it, Absolute OpenBSD.

Anonymous said...

If you prefer your desktop to "just work" fluidly, then why wouldn't you use Windows? Joking aside, most of us probably use XP in a home or work environment and don't think twice about the OS we're on or whether a new piece of software is compatible...it "just works."

Not suggesting that you should be using Windows, I just wonder if there's another criteria that you're applying in your choice of desktop OS.

Richard Bejtlich said...

Hi Anonymous,

Well, I'm typing this on Windows right now. I triple-boot my personal laptop with XP, Ubuntu, and FreeBSD. I use whichever runs the software I need for the task at hand. I spend most of my time in Linux.

Marcin said...

@anonymous If it wasn't for Cygwin, I'd go insane.

Seriously, how awesome is having bash or tcsh, with the likes of grep, sed, awk, perl and python at your fingertips?

Thanks Richard, I now have a book I can use my Amazon gift certificate on :)

Fred said...

We have a couple of "production" laptops at the house, one of which is windows. Its what my wife prefers, and I prefer being married, so windows is what she uses. On a personal use basis I prefer Linux because of the amount of tools available in the open source community. From photo editing to making backups of dvd's, these tools are freely available. Professionally, I prefer Linux, again due to the tool sets available, and the ability to readily secure the OS. That said, if an employer or customer has windows requirements...... then guess what I use. I no longer fight that topic. I make the best of the situation at hand.

John Ward said...

Saying "How do you learn Unix" is a pretty vague question. It like saying "I want to do programming", or "I want to learn sports". If you ask a follow up question like "To do what", you can get a much more specific field to focus on.

For instance, if someone wants to learn Unix to just do their daily work vs someone who is an administrator or a programmer, the toolset that they will use regularly gets drastically narrowed down. Your everyday desktop user doesn't need to know commands for checking number of open sockets, process id's, or scripting just to get by (excluding power users of course). Let them learn what they need to be productive, and branch out from there.

Anonymous said...

Where would you suggest going after this as an introduction to security for an experienced computer user who is inexperienced in network security?

kace said...

I'd like to suggest the "budget" options. First and foremost, The FreeBSD Handbook. It's such a great guide. Another thing to consider is Greg Lehey's book, The Complete FreeBSD, which he has released under an open license. Some parts of it will now be out-of-date, but it's good.

I don't suggest that either (or both) of these could equal "Absolute FreeBSD". But, for people with an interest but maybe not ready to commit cash, it's a fine start.

Charlene said...

I have a question about freeBSD. After speaking to one of the original desingers of MySQL, he recommended not using freeBSD for MySQL. Instead he suggested Linux. So when I was setting up a server that is used primarily for MySQL I went with his suggestion.

I work with several other freeBSD servers, and we're in the process of upgrading to newer servers. An outside security vendor told my client/boss that freeBSD wasn't very secure compared to Linux (of course he does hosting and doesn't use freeBSD).

We're currently looking at a new hosting company because when we were hacked, we discovered that the firewall was turned off and very little other security help was available. We probably won't go with the outside security vendor we used to secure our current servers a little bit more because we need full 24x7 support (we have over 200 websites that we host and support) from a hosting company.

Is it safe to stick with freeBSD, or should we make the switch to Linux?

Richard Bejtlich said...

Hi Charlene,

I've used MySQL and PostgreSQL on FreeBSD for seven years and I've been happy with it.

As far as FreeBSD being less secure than Linux, that outside "security vendor" is ignorant.

That being said, your level of security is more likely to relate to your familiarity with the OS you choose, your ability to configure it, and the services you have to provide.

Charlene said...

The MySQL developer (I know I said designer) said that at least on older versions of freeBSD, MySQL was not as efficient as Linux. It's possible that the more recent versions of freeBSD are better. We were quite happy with running MySQL on the freeBSD, but decided to follow the MySQL developer's advice when we moved MySQL to it's own server.

As to configuring our servers we depend on our hosting company, although I am the one who sets up Perl, PHP and MySQL (the Perl CPAN DBD::mysql will not install without MySQL actually being installed on the localhost).

I am working on getting the books you recommended. I do have the book Kace recommended The Complete FreeBSD.

At home I'm working on setting up a Fedora Linux box (Need to get a case, motherboard and memory). Is Ubantu really supposed to be better than Fedora? This box will be networked with my main PC and running a program called Synergy which allows me to control the second computer from the main PC (especially useful since my main PC has a resource problem and I can offload some applications to the second computer).

BTW Do you know if Unix has the same resource problem that Windows has? Most people will not know what I'm talking about, but I run out of Window's resources before I use up all 2Gig on my main computer (usually only 1.6GB). M$ actually has acknowledged that I had a problem, but I never got around to working on it with the developers because I had to turn off anything that wasn't M$. One of the manifestations of it is that when I try to open a new window it won't. Another is that Dreamweaver will crash with no error message. When I upgraded from Win2K to XP I had hoped the problem would be fixed.

Antônio said...

The book UNIX System Administration Handbook (3rd Edition) can still be used or is outdated?

VernonO said...

One reason I have shied away from Ubuntu is that the "universe" repository of software packages does not receive any strong security patch attention( http://www.ubuntu.com/community/ubuntustory/components ).
Debian stable ,which I really like, receives security attention, but the binary packages are older.
FreeBSD has portaudit which is very nice, but upgrading ports can be tricky.
Of course, in the NSM view of the world, security patching is only part of the picture.