Laser Blog

Articles tagged "tech tips"

70 Shell stuff: job control and screen

Monday 26th March, 2007

Now there is also tmux.
Rob. April 2015.

A look at using shell job control, plus a quick overview of what I consider to be the best alternative to job control, GNU screen.

37 Solaris 8: NIS installation and configuration

Monday 15th January, 2007

(This article has been redrafted to include Solaris 10-specific commands and entries, as well as retaining the original Solaris 8 commands. In addition a couple of typos have been fixed and an extra note about changing the NIS Makefile has been added. This original article has not been altered, so follow the link above if you want to see the redrafted article.)

This is a step-by-step account of the method I used recently to install and configure a NIS master and slaves on servers running Solaris 8. The steps detailed should work fine on other 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.)

33 Learn 10 good UNIX usage habits

Saturday 16th December, 2006

Link updated April 2015.

An article which shows 10 UNIX bad habits and teaches 10 good UNIX usage habits. This is all command-line stuff, and I found a couple of these to be things which I do/did. The only problem is trying to stop those bad habits which you've been doing for years ... :(


27 Sorted!

Friday 1st December, 2006

This site has some great visualisations of how different sorting algorithms work. It not only demonstrates how they work, but their comparative speeds as well. If you've ever used sorting algorithms in your code, I think you'll find this interesting. (Requires Java.)


23 command-line calculations using bc

Sunday 26th November, 2006

If like me, you do most of your work from the command-line, using vim to edit files, mutt for e-mails, cd/ls/mv/find/etc instead of a file manager, then you may get annoyed by having to fire up a GUI calculator to make (what may sometimes be) a single calculation.

One useful feature of calculating on the command-line is that you can see what you've typed. For instance, sometimes when I'm entering a long, complex calculation on a calculator (either the GUI or the solid, hold-in-your-hand type), I sometimes forget if I've actually typed in all those numbers or made the calculations in the right order. Maybe it's just me ... :)

This article shows how to quickly perform standard calculations on the command line including addition, subtraction, multiplication, division, square root, powers, conversion from decimal to hex, decimal to binary, hex to decimal, and binary to decimal. It also briefly introduces using bc in interactive mode and how to write files for use with bc for frequently repeated operations. There is a mention of using Google for performing calulations. It finishes with a little challenge to test the power of your CPU.

Other advantages of using bc include:

  • bc is included with (almost?) all Linux distros as standard, as well as (again, almost?) all Unices.
  • Results from calculations in some proprietary flavours of bc have up to 99 decimal digits before and after the decimal point. This limit has been greatly surpassed in GNU bc. I don't know what that limit is, but it's at least many, many tens of thousands. Certainly it's more than any GUI-based calculators (I've used) could accomodate.
  • You may also find yourself working in an environment where you simply don't have access to a GUI.
  • The syntax for basic sums is almost identical to Google's calculator function, so you can learn how to use two utilities in one go!