Laser Blog

Articles tagged "tech tips"

107 Three awk resources (and one old sed)

Wednesday 14th May, 2008

I use awk (or rather gawk and nawk) a lot, and I was intrigued to find two resources on the internet very recently. This sort of information used to be hard to come by, so it was good to find it.

The first (and IMO the best) resource I found was an awk tutorial called Getting started with awk.

The second was an Awk, Nawk and Gawk cheat sheet.

Add to that my old favourite Handy one-liners for awk, which seems to have taken it's inspiration from the venerable and much-queried Handy one-liners for sed, and you have the four resources hinted at in the title. I hope it proves useful.


97 The many uses of gcal

Friday 19th October, 2007

gcal is a remarkable console-based program.

  • It can be used to print calendar information, much like cal, but with much more flexibility.
  • It can display holiday information for over 300 different countries and states.
  • It can display astronomical information such as sunrise, sunset, the current phase of the moon and much more.
  • It can also be used as a diary or personal reminder.
  • It can print the current date and time. (No, really! :) )
  • It can be used to display the start and stop of daylight saving.

I'll be providing examples of how to use gcal in all these ways. Bear in mind that this article just scratches the surface with regard to what gcal can actually be used for. You are limited by your imagination!

95 Solaris: NIS installation and configuration

Wednesday 5th September, 2007

(This article has been updated from the original, which focused on Solaris 8 only, to include Solaris 10-specific entries. Where the commands or entries for Solaris 8 and Solaris 10 differ, they are written down in purple for Solaris 8 and green for Solaris 10. In addition, I have added an extra note about changing the NIS Makefile in the event that you're not going to use group passwords.)

This is a step-by-step account of the method I used to install and configure a NIS master and slaves on servers running Solaris 8 (and more recently, Solaris 10). The steps detailed for Solaris 8 should work fine on earlier versions of Solaris, but as I have not explicitly tested other versions (except as clients) you may encounter issues. The clients used with this setup ranged from Solaris 7 to Solaris 10. The installation was in a medium-sized Solaris-only farm (100+ hosts).

Configuring NIS on Solaris is not quite as straightforward as it is on other OSes (such as some Linux distros). This didn't really surprise me, even though NIS is Sun's product. What this does allow is a more tailored end product.

There are three points I'd like to emphasise concerning this article:

  • This article is not an definitive how-to; there is more than one way to implement NIS. This way works, it's relatively straightforward, and is more secure than a default NIS installation.
  • This article is not an endorsement of NIS over other naming systems. My recommendation to the client was to use LDAP, but NIS had been used before, they were more or less happy with it *, and it did what they wanted it to. Having said that NIS is still used on many sites, it's versatile, it's easy to set up and maintain, and it can be made more secure without too much extra effort.
  • This article describes the set up of NIS only. Administration is another matter altogether.

(* The client's existing NIS setup was very old and exhibited quirky behaviour on some rare occasions. In addition, it had allowed encoded password values to be seen when running ypcat passwd. This was not acceptable.)

75 Regular expressions

Friday 4th May, 2007

Link updated April 2015

Part nine of the IBM DeveloperWorks series Speaking UNIX focuses on regular expressions. This is a huge field, and as usual, there are some great tips here. Well worth a read.


73 Using a USB external hard disk for backups with Linux

Monday 23rd April, 2007

In this article, I show how I set up a recently purchased USB external hard disk drive as a backup drive for my Linux desktop PC. I'll delete the default FAT32 partition, create a new partition, make a reiserfs filesystem, and show how to use rsync to backup your important data.