Introduction to Linux

How is Linux different from Windows/Mac OS X

At the moment you’re probably using Windows/Mac OS X, and it works for you, so what’s the big deal with Linux? Below are some computing concepts which you probably haven’t been exposed to in the Windows/Mac OS X world. My goal is to expand and improve your computer experience.

Reliability and security

For practical purposes, Linux never catches viruses, and doesn’t spend most of its lifetime being twitchy and slow. Once Linux is customized to the the quirks of particular hardware, it will run well on it indefinitely. You don’t need to reload Linux every six months to get your performance back. Also, it is common to stay logged into a Linux Mac OS Xhine for months at a time. This is a “desktop” experience much like a physical desk. You can interrupt work in progress and expect to be able to go back to it later. The sight of the arrangement you left it in will jog your memory of what you were doing. If you’re doing this on a laptop, your suspend and restore feature must be rock solid.

On all the time

Linux is on all the time, and as long as it’s on, it may as well be doing work for you. What sort of computations could you do with 35 Mac OS Xhines that are on all the time? Linux is multiuser, so your use of a Mac OS Xhine doesn’t prevent anyone else from using it, as long as you exercise good taste about resource consumption.

Easy programming: the shell

Windows/Mac OS X generally has exactly one way to control a program: the GUI (Graphical User Interface). By contrast, Linux usually has one, the shell command line, and occasionally a second, a GUI. For instance, the shell command wget can copy an entire web tree in a single operation, which is complimentary to the interactive work you can do in a browser. Linux programs are designed as Lego building blocks that you snap together. Programming Linux starts off easy, with scripting. You put a couple commands with long arguments in a file, so you don’t have to keep typing them in. Perhaps these commands sync portions of your laptop disk to your Statistics account for backup purposes. Then you add a couple more commands, perhaps to keep dated backup versions. Soon you’re outside of the range of what you could achieve on Windows/Mac OS X. The shell is what lets you plug together 2,400 little building-block programs. You will soon know the names of 50 of them corresponding to things like dir and copy from Windows/Mac OS X, and every program you can use as a “command” is one you can script. The Linux statistical computing environments, such as R, leverage rather than attempt to replace these tools.

Feature stability

I have been using essentially the same editor (eMac OS Xs) and email program (mh-e) for 20 years. That’s before the web, and five years before Microsoft Windows/Mac OS X 3.0. Imagine the payback on my investment in learning those programs. How many different Windows/Mac OS X editors and email programs have you had to learn in that time?

X-Windows/Mac OS X remote display

Linux has the concept that where you run a program can be different from where you interact with the program. You can run your big crunchy R program on the meaty server on the closet, but you don’t have to physically sit in the closet in front of the console. Instead, you can send the GUI back to your desk.

Mathematical typesetting

The world standard for mathematical typesetting is the TeX (pronounced “tech”, spelled “tex”) family of programs. Of these the frontrunner is LaTeX (pronounced “la-tech”, spelled “latex”). With improvements to latex in the last decade you are not limited to the classic latex style. Like HTML, Latex is an example of the “markup” style of typesetting systems. In a markup system, the text of the document is interspersed with declarations about what purposes the pieces of text serve in the document, and to a lesser extent what the text should look like.

Latex has been improved and simplified quite a bit in the last decade. There’s a whole lot of latex code floating around that is more cumbersome than it needs to be now, so latex is an exception to the general rule of programming that you should learn by copying code from other programs. Save yourself hassle and write your latex from scratch with a good reference book like Kopka. However, there is dedicated University support for writing your thesis in latex, which you should not do from scratch. Ask others when you are ready.

Word Processing

Word processing for small things with no mathematics like a letter to a potential employer can be done perfectly well in latex. However, if you’re doing something that’s mostly graphics design like a sign, you might find one of the Adobe Illustrator or Visio clones a better match for the problem. Try out inkscape, dia, and xfig. For the Adobe Photoshop kind of bitmap editing, use gimp. If you’re graphing data, use R.

Latex example

A letter on the departmental letterhead looks like this:

\documentclass[12pt]{letter}

\usepackage{epsf}
\usepackage{myltr}
\usepackage{times}

\begin{document}

\date{August 19, 2010}

\signature{My Name}
\address{}

\begin{letter}{}

\opening{Dear Mom,}

Word processing in Latex was easier than I had feared.  Now I can do
all of my professional work in latex on Linux!

\closing{Love,}
\end{letter}

\end{document}

This letter depends on the file myltr.sty, wherein I have customized my name and address into the letterhead. However, if you remove the usepackage for myltr, it will work standalone, sans letterhead.

Microsoft Office compatibility

Microsoft Office files can be read by Open Office. As of August 2010, Open Office’s compatibility is good enough to read Office documents, but not good enough to reliably collaborate with Office users. The shell command to start up the Open Office suite is ooffice, or oocalc, oodraw, oowriter, and ooimpress (PowerPoint clone) for the individual pieces.

Statistical Software

R

R is a free software clone of S. It has collected lots of free software development interest. It is a serious program which is attracting careers of professional work. We recommend it due to the open source benefits of longevity and control. It runs nicely inside eMac OS Xs. If you implement your statistical research results in R and publicize them, it is much more likely that people will use them.

Example of R

The shell command is R. A session looks like this:

bb@mako:~$ R

R version 2.11.1 (2010-05-31)
Copyright (C) 2010 The R Foundation for Statistical Computing
ISBN 3-900051-07-0

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> x  y  plot(x,y)
> q()
Save workspace image? [y/n/c]: n
bb@mako:~$

After the plot command, a window appears showing the plot. The “Save workspace image?” question wants to save all the variables and functions you’ve created within R’s memory into a file, so that you can read them all back in and pick up where you left off in a later R session. Most R users I’ve spoken to tend not to use saved environments, instead preferring to keep their data and functions in ordinary text files where they can “put their hands on them”.

Specific commands

Windows/Mac OS X equivalents

Windows/Mac OS X Unix
dir ls
cd cd
copy cp
rename mv
del rm
pwd pwd
more more
print lpr
help man

File viewers

PDF xpdf, acroread
PostScript gv
GIF, JPEG xloadimage, gimp