Archive for December, 2007

Belated Christmas Greetings from Archaeogeek

Both myself and Mr Archaeogeek are only just surfacing after possibly the worst Christmas colds we’ve ever had. Thank goodness we were safely ensconced at my parent’s house being looked after and pampered. So, now I can type coherently again, belated Christmas Greetings to everyone, and here’s to a great 2008.

Apologies also for missing my Thursday Tip Day- I have some corkers lined up related to OpenStreetMap data, and (lovely, shiny, new) IPod Touches but they will have to wait…

Thursday Tip Day: Different ways to get help at the linux command line

Man is not the only option for help about a command in linux.
whatis — Display a summary of a command (rather than the entire manual)
apropos — Display a list of commands that pertain to (are apropos to) a keyword
whereis — Display information about the location of a command: the executable, the source code (if any), and the man pages.
which — Display which version of a command will execute (for when there are two, or more, commands with the same name installed on the system).

Thursday Tip Day: Explaining the Unix filesystem

For all linux/Unix n00bs out there, here’s a really good explanation of the layout of the Unix filesytem.

What’s in a file name? The files on a UNIX machine are organized in a hierarchy. The very top of the hierarchy is / —commonly referred to as “slash” or “the root directory.” If you change your working directory to / and run ls, you’ll see several subdirectories with cryptic names like etc, bin, var, home, and tmp. Although UNIX now supports long file names, most of the monikers of these top-level directories hark back some 30 years to the origin of UNIX. Similarly, by the same long-standing conventions, each directory contained in / serves a special purpose:

  • /bin is but one of many directories that contain applications and utilities. However, /bin typically contains utilities that are essential to system operation. Hence, the shells, file-manipulation commands such as cp and chmod, compression and decompression, and diagnostics reside in /bin.
  • /sbin also contains utilities crucial to system operation and maintenance. However, the programs found in /sbin can be executed only by superusers—hence, “superuser-bin” or /sbin. /dev incorporates all the hardware installed on your system, including terminals and USB devices (and other peripherals that are physically connected to the computer), pseudo-terminals (used to interact with X terminal windows), and hard disk drives, among others.
  • /etc (often pronounced “etsee”) is dedicated to system configuration. The /etc directory contains configuration files for the system daemons, startup scripts, system parameters, and more.
  • /home contains a user’s home directories. For instance, if your login name is joe, the directory /home/joe acts as your personal file repository.
  • /lib is the coffer for essential system libraries. In modern UNIX, system libraries are typically shared, meaning that the libraries are not linked and included in each binary (which would waste space, at the least), but are loaded on demand when needed and shared by many applications at once. Hence, core applications and utilities installed with UNIX require the libraries in /lib to run, and you need at least a small handful of the libraries to create new executables from source code. All files here are vital, and the corruption or removal (whether intentional or accidental) of even one file can render a system useless.
  • /mnt, short for “mount,” is the standard location to mount hard disk drive partitions and other devices. If you want to see which devices are currently mounted and accessible, simply run the mount command.
  • * /tmp, or “temporary,” is the system-wide scratch pad. Your Web server might stash session data files here, and other utilities use the space in /tmp for caching intermediate results. Files in /tmp are considered disposable. Indeed, your systems administrator probably deletes all files older than a certain expiry every evening.
  • /usr is the umbrella for a great number of files. End-user applications—from editors, games, and interfaces, to system features—are here, as is the library of man pages along with much more. Chances are that if the file is useful but not mandatory for system operation, you’ll find it in /usr.
  • /var —short for “variable”—is the repository for files that typically grow in size over time. Mailboxes, log files, printer queues, and databases can be found in /var. It’s commonplace also for Web sites to be kept in /var because a Web site tends to amass data preternaturally over time.

Thursday Tip Day: Running PostgreSQL without making it a service

PostgreSQL from 8.2 onwards can be run easily from the command line in windows, without setting up as a service.

Go to your postgresql/bin folder and at a command line type:

pg_ctl start -D location\of\your\data\folder (as specified in initdb) -l logfile

This should output a notice telling you whether the server has started up correctly. It also saves output to a logfile in the bin folder. If the server starts without incident, open another command window at the same location and type:

psql -d yourdatabase

This will allow you to use PostgreSQL as a command line tool.

To stop the server, type (in your second command window):

pg_ctl stop -D location\of\your\data\folder

Next Page »