The Linux Platform

When the C++ course is given on a Linux platform, there isn't quite the integrated development environment that we might get with the Windows or Mac platforms. (But then we won't have paid (as much) and we won't be a the beck and call of Microsoft and their ilk.) This document will try to acquaint you with some of the tools you might be using.


We will be spending as little time as possible with operating system commands. You will want to at least make and change directories.

To change the working directory (folder, ppn) use

cd mySourceFolder

To print (display on screen) the working directory use


To make a new directory use


We'll stop highlighting the mnemonic now unless it's particularly obscure. You get the idea that Unix (Linux's forebear) began on a slow teletype and the oldest commands are short (and sometime mnemonic but not always--awk represents the hubris of its creators Aho, Weinberg and Kernigan. (Yes, it's that man again. Some of the most cryptic OS is from the same man (and even more so his partner Ritchie) who brought you that most cryptic of languages (leaving aside Perl (as one probably should (at least for controlling nuclear reactors) (mind you, Lisp has more parentheses (even than this paragraph)))) namely C (and therefore C++). They didn't begin it all however; that honour goes mostly to Ken Thompson.)

To list the contents of a directory


Like many commands, ls has a plethora of switches to modify its behaviour. At least the switches are always (well you know what I mean) introduced with a minus, unlike later operating systems like Windows, where Microsoft decided to use the forward slash to introduce a command switch, but some authors decided that that was silly (which is probably true) and decided to carry on using the Unix minus. (Here's an unkind and manifestly untrue definition of Windows found in a newsgroup somewhere. Windows 95: n. 32 bit extensions and a graphical shell for a 16 bit patch to an 8 bit operating system originally coded for a 4 bit microprocessor, written by a 2 bit company that can't stand 1 bit of competition.) (And just to balance things, there are conspiracy theorists who firmly believe that Unix and C, somewhat like the QWERTY keyboard, were designed to slow down the rate of software development.)

To get ls to recurse into subdirectories, for example

ls -R

To get a long listing

ls -l

In general you can try to get the manual entry for a command with something like

man ls

Although parts of GNU (Linux) now deprecate man in favour of info. Try both.

The file system has a single conceptual root denoted with a forward slash. Unlike DOS and Windows, the filesystem isn't organized around disk partitions. (Devices are mounted into the filesystem at chosen points. They are usually under /mnt in Red Hat Linux--/mnt/cdrom for example.) You will have a home directory and will be placing your work in a directory off your home directory. Use cd on its own to go to your home directory; and pwd to find out where you then are.

(Red Hat is a distribution of Linux. If anyone less than a level-8/guru tried to compile and install Linux on their own, it would take many days or weeks. Red Hat (or others such as Caldera, Debian or SuSE) kindly do all that for us.)


You must be able to use one of the editors before you join the course. If you are, and always have been, a Mac or Wintel person it might seem somewhat odd to insist on this. In the world of Unix though, even the scroll bars of different editor cultures work in very different ways. (And there I go indulging in my own preferences. There are Unix sub-cultures that believe the use of scroll bars is indicative of moral laxity. There are of course many Unix editors that have no scroll bars at all.)

You may already be an emacs user. If so you are probably beyond this humble document. (A novice once asked the master if emacs possessed the Buddha nature. The master had resided in the temple for a good many years, and was very wise. He thought for a while, and then answered: 'I don't see why not, it's got bloody well everything else.')

A good choice of editor if you have no particular favourite of your own is gvim. gvim stands for gui version of vi improved. vi was one of the two original Unix text editors and stood for visual editor. (You need to read visual in the context of twenty years ago when VDUs were just starting to appear. Although it's interesting to see one of the earliest appearances of the visual adjective so beloved of marketing departments.)

The improvements are many and include allowing the use of the mouse and the modern cursor control keys. Other reasons for perhaps choosing gvim is that it does syntax colouring and auto-indenting. Finally, if you learn the keystroke-driven core (vi itself) of vim, you will know at least one editor certain to be found on almost any dialect of Unix you are ever likely to come across. (Oh, and if you also use Windows, you can get a version of vim and gvim for it.) (And the bash shell, which your lecturer will probably be using, can be set to use vi key-codes for command line editing with set -o vi.)

(And what's the bash shell? The text command interpreter is known as a shell. If you've used the DOS prompt in Windows then you've used the, somewhat impoverished, shell. The Mac tried to avoid users having to know such interfaces to the operating system existed. Unix is at the other extreme; there are at least six shells to choose from and arguing the pros and cons of which to use can become highly religious. The originals were sh and csh. The standard Linux shell is bash (borne again sh). The standard CERN installation of Linux favours tcsh.)

There is a tutorial to get you started on vim. On Red Hat Linux it's /usr/doc/vim-xxx/tutor/tutor. If you're a mouse-oriented person and don't particularly want to learn vi (rather than gvim), the tutor isn't too helpful; but you can just use the menu bar, your mouse, your cursor control keys (arrows, page-up and -down, home and end) and scroll bars.

The standard CERN installation of Linux includes nedit. If you don't want the command-line-like control that emacs or vi can give you, nedit might be the editor for you. It's not official Linux because it isn't open source. It is rather good however. It has syntax colouring, auto-indenting and, I'm told, the ability to execute a compile and to grab and display compile errors.

[ Briefings Home Page | Books by John Deacon | JDL Home Page ]