Category Archives: linux

Create pdf thumbnails

This perl script uses ImageMagick to convert the first page of a directory structure of pdf’s into a 600 pixel wide png thumbnail.  The [0] in file.pdf[0] means to convert only the first page.

#!/usr/bin/perl -w
use strict;

my $tmp = `find . -iname '*.pdf'`;
print "$tmp\n";
my @files = split(/\n/, "$tmp");
foreach my $file (@files)
{
  my $outfile = "${file}.png";
  if (! -f $outfile)
  {
    my $command = "convert -thumbnail 600 '$file\[0\]' '$file.png'\n";
    print $command;
    `$command`
  }
  else
  {
    print "$outfile already exists\n";
  }
}

Screen Blanking on Linux Consoles

Linux consoles will blank after a few minutes. These are the screens which you get if you type ctrl-alt-f1 through ctrl-alt-f6 when you are logged into x-windows. To disable this behavior, type:

setterm -blank 0