How can I reduce the file size of a scanned PDF file?

Use the following ghostscript command:

gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook \
-dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf

Summary of -dPDFSETTINGS:

  • -dPDFSETTINGS=/screen lower quality, smaller size. (72 dpi)
  • -dPDFSETTINGS=/ebook for better quality, but slightly larger pdfs. (150 dpi)
  • -dPDFSETTINGS=/prepress output similar to Acrobat Distiller “Prepress Optimized” setting (300 dpi)
  • -dPDFSETTINGS=/printer selects output similar to the Acrobat Distiller “Print Optimized” setting (300 dpi)
  • -dPDFSETTINGS=/default selects output intended to be useful across a wide variety of uses, possibly at the expense of a larger output file

Reference: https://www.ghostscript.com/doc/current/VectorDevices.htm#PSPDF_IN:

Controls and features specific to PostScript and PDF input

-dPDFSETTINGS=configuration

Presets the “distiller parameters” to one of four predefined settings:

  • /screen selects low-resolution output similar to the Acrobat Distiller (up to version X) “Screen Optimized” setting.
  • /ebook selects medium-resolution output similar to the Acrobat Distiller (up to version X) “eBook” setting.
  • /printer selects output similar to the Acrobat Distiller “Print Optimized” (up to version X) setting.
  • /prepress selects output similar to Acrobat Distiller “Prepress Optimized” (up to version X) setting.
  • /default selects output intended to be useful across a wide variety of uses, possibly at the expense of a larger output file.

The exact settings for each of these, including their DPI values, are shown in the dozens of options in this table: https://www.ghostscript.com/doc/current/VectorDevices.htm#distillerparams.

Wildcard ‘*’ versus Exact Match ‘@’ DNS records

Ever wondered what the difference was between the ‘@’ symbol and the ‘*’ symbol when setting up a DNS Zone file for a domain name.  In the past I have seen them used interchangeably with sometimes unexpected results.

The difference is that one (@) is for exact match search where there is no subdomain and the other (*) is a Wild Card – they are not interchangeable in all circumstances.

 Consider the following Zone File for domain name xyz.com,  

  • Any DNS request for an MX (mail) record for xyz.com (with no prefix) will return the two MX records mx1.mailserver.com and mx2.mailserver.com
  •  Any DNS request for an MX (mail) record for the subdomain branch.xyz.com will return the two MX records mx3.mailserver.com and mx4.mailserver.com
  •  If an A record request for the hostname ‘xyz.com’ is made, an exact match for this record with no subdomain is used (@) and it will return the IP address 103.6.216.204.
  •  If an A record request for the hostname ‘www.xyz.com’ is made, an exact match for this subdomain is used and it will return the IP address 103.6.216.205
  • If an A record request for any other hostname  e.g.  ‘branch.xyz.com’ is made, the wildcard record (*) is used it will return the IP address 103.6.216.203.

 In summary then;

 The prefix ‘@’ refers to the domain name itself — it essentially means no prefix.

  The prefix * is a wildcard — if a DNS request is made for an address that does not have a specific A record setup, then the wildcard IP address will be returned.

Source: https://www.apexdigital.co.nz/blog/wildcard-versus-exact-match-dns-records/

What the Heck is –Mark–? Learn Linux Logging

You hear it all the time: Monitor your logs. When there is a problem, check the logs. And it’s good advice, because system and application logs tell you anything you need to know, provided you actually look at them and understand what they are saying.

Viewing logfiles is merely a question of volition; understanding what they are telling you is a another kettle of clams entirely. Today we’ll look at what you might find in your network activity logs, and what it all means. Then you’ll know if you need to leap heroically into action, or if you can return to sipping your iced tea and catching up on your sadly-neglected napping.

The Mysterious — MARK —
All newbie admins asks what this means in /var/log/messages:

Jul 1 16:04:53 windbag — MARK —
Jul 1 16:24:53 windbag — MARK —
Jul 1 16:44:53 windbag — MARK —

That’s just the syslog daemon letting you know that it is alive and well. You may set the interval to anything you like on Debian by editing /etc/init.d/sysklogd. This sets it to 60 minutes:

SYSLOGD=”-m 60″

Then restart the syslog daemon:

# /etc/init.d/sysklogd restart

On Red Hat and derivatives, edit /etc/sysconfig/syslog :

SYSLOGD_OPTIONS=”-m 60″

Restart syslogd with service syslog restart. Then watch it happen in realtime on any Linux with tail -f /var/log/messages. (You can monitor the changes in any text file with tail.)