I have a .csv file with hundreds of rows pulled out via PostGIS.
The geospatial information is in "the_geom" field which seems to be in WKB-format.
How can I convert this to shapefile using simple free tools?
You can skip the CSV step and just go straight to shapefile using pgsql2shp, which is installed a part of PostGIS.
You could also use ogr2ogr.
As a free on-line solution for the conversion of CSV with WKB data you can use MyGeodata Converter. Just name your column with WKB data as "wkb" - like this example:
id,name,wkb 1,Point 1,010100000000000000000048400000000000003340 2,Point 2,010100000000000000000046400000000000002E40
The WKB data will be automatically recognized based on the occurence of "wkb" string in a CSV column. Any geometry type is supported - point, linestring, polygon, ... If you have WKT, use name "wkt" of the column... Hope it helps - for me it works. It is based on GDAL/OGR VRT driver. Most of GIS/CAD formats are supported - both input and output data.