Laser Blog

Articles tagged "command line"

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.)

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!

16 Slash'EM on Linux: configure, install, setup and play

Tuesday 7th November, 2006

When I tell my World of Warcraft/EverQuest-playing friends that I play Slash'EM, they usually raise their eyebrows and give me a slightly condescending smile before going on to explain how they prefer 3D graphics, interaction, etc. The fact is that comparing WoW/EQ to Slash'EM is like comparing movies to books. Did you read the Harry Potter books? Did you then go and see the movies? Slightly disappointed? Not quite what you expected? Then you'll have an inkling of what I'm on about.

As with reading, some imagination is required. Compared to it's more modern peers, Slash'EM and its relatives are extremely challenging. If you get it wrong, your character dies. Sometimes your character will die in seemingly grossly unfair circumstances. And it's permanent, unlike in certain other games. C'est la vie. This game hasn't been designed to pander to the requirements of the "I want it all and I want it now" crew.

It's a bit sad that such a fine open source game is easier to install on Windows than it is to install onto many Linux systems. So, hopefully this article will address that issue.

11 Shell stuff: more multiple file renaming goodness

Wednesday 25th October, 2006

I had an e-mail from a guy named Devon telling me yet more ways to rename multiple files. I thought they were pretty good (damn it!) and had to share these new (to me) techniques.

These alternative methods seem to require the use of the Bash shell, so some people may not wish to read any further!

10 Shell stuff: rename multiple files on the command line

Tuesday 24th October, 2006

If you wish to quickly rename multiple files in a directory, a for loop (sometimes combined with other utilities such as sed or tr) is one way to do the job.

The examples in this article include removing spaces from filenames, adding and removing suffixes and prefixes, and changing from uppercase to lowercase.