getting started with linux

introduction

In order to enjoy programming with C, C++, Java or Scheme on a machine running the Linux operating sytem, you will first need to obtain an account on such a machine (see Prof. Lankewicz) and then you will need to become familiar with a few basic operations. Here is a list of a few things to concentrate on to get you off to a good start.

Linux.org have a nicely organized and very accessible online course entitled "Getting Started with Linux." Their objective is "to get you the beginner with Linux to the point where you can do everything that you do with MS Windows, in Linux and much more." Similar courses on Linux system administration and Linux security are expected shortly.

Here is nice tutorial from the Computer Science Department at Indiana University which covers much of what a computer science student will want to know about using unix workstations. And here is a more complete tutorial on the entire linux system. A good place to start looking for detailed information on Linux topics is the Linux Documentation Project.

Here are a few of Dale's C++ files to use for practicing with g++:


 

printing files

Many files are most easily printed from inside the application used to create or view them. For example, use Netscape to print web pages, and StarOffice to print spreadsheets, and the printing details will be handled by that application (except for telling you where to go to fetch the result). Code files are best printed with a2ps or enscript. The generic printing utility on a Unix system is called lpr, a designation that used to stand for "line printer" but nowadays presumably stands for "laser printer." The printers available from your machine will be listed in /etc/printcap. They likely have short names like lp, lp2, lp3. To print a file called stuff.txt on the default printer, type

lpr stuff.txt

To print the same file on the printer with designation lp2, type

lpr -Plp2 stuff.txt

PostScript files are best viewed with Ghostview. To view the file stuff.ps, the Postscript version of stuff.txt, type

gv stuff.ps &

To print the Postscript file stuff.ps click on "Print All" or "Print Marked" in the lefthand margin of gv. A dialog box appears indicating that it will use the default print command lpr. If you want to print on lp2 instead, modify the print command in gv's dialog box to read

lpr -Plp2
 

emacs

Emacs is a remarkable text editor with many special features of interest to programmers. Among other things, it is programmable. You can write code to change its behaviour. For a simple example, first launch emacs and simply observe the colors of the foreground, background, and cursor, and notice the font. Then create a file named ".Xdefaults" in your home directory containing the following lines, and launch emacs again. What happens?

emacs*Background: DarkSlateGray
emacs*Foreground: Wheat
emacs*pointerColor: Orchid
emacs*cursorColor: Orchid
emacs*bitmapIcon: on
emacs*font: fixed
emacs*geometry: 80x25+250+100

telnet

Suppose you are sitting at one machine but want to work on another machine somewhere else. The telnet application can handle this situation very gracefully. First, enable an xhost on your machine by entering the command

/usr/bin/X11/xhost +

Then telnet to the remote machine as follows:

telnet remote.machine.name

and type in your login and password when prompted to do so. Now, on the remote machine, enter the commands

export DISPLAY=your.machine.name:0.0
/usr/bin/X11/xterm

and wait a few seconds for the xterm window to pop open on your machine.

Here is a short transcript of such a session (leaving out a bit of extra information the system will print to your screen). All of the typing happens on the machine named calypso. We are connecting to a machine named io.

/usr/bin/X11/xhost +
telnet io
            // we are now knocking on the door of io
johnDoe     // John's login on io
********    // John's password on io
												// we are now connected to io
export DISPLAY=calypso:0.0
/usr/bin/X11/xterm
            // io's xterm window appears on calypso's monitor -- cool!
            // now do some work
            // when you are ready to disconnect from io, dismiss the xterm window
            // and type "exit" to the io prompt
 exit       // exit io
            // we are now back on calypso

 

tar

In the old days, tar made lots of Tape ARchives. Nowadays, for the most part, it just makes archives, and tapes don't have to be involved. An archive is a bundle of files. Since bundles of files can get to be pretty large, tar is often used in conjunction with file compression and decompression ("uncompression") utilities named gzip and gunzip. The latest versions of tar can do both archiving and compression/decompression. The following are three commonly used tar commands:

tar xzvf name.tar.gz        // extract from archive
tar tzvf name.tar.gz        // list table of contents of an archive
tar czvf name.tar.gz name   // create an archive



cparrish@sewanee.edu