Category Archives: Terminal

Compiling / playing nethack 3.6.0 on Ubuntu or Debian

UPDATE: Instructions added for enabling the hilite_status feature to get nice coloured Hitpoint & Hunger highlighting

After a 10+ year hiatus, the NetHack DevTeam is happy to announce the release of NetHack 3.6, a combination of the old and the new.

- nethack 3.6.0 release notes

It took me a while to figure out how to actually get nethack v3.6.0 running on Ubuntu, so I’ve shared what I learned for others.

Thanks to Jochen, we can also get this compiling on Debian Jessie.

Get setup

  • Install the dependencies
    • sudo apt-get install flex bison build-essential libncurses5-dev checkinstall
  • Get the source
  • Extract the source
    • tar xpvzf nethack-360-src.tgz

Prepare the source

  • Edit include/unixconf.h
    • Change /* #define LINUX */ to #define LINUX
  • Edit sys/unix/hints/linux to be as here.
    • For Debian Jessie, change the HACKDIR=... line to be HACKDIR=$(PREFIX)/lib/games/$(GAME)dir
  • If you want to enable Status Hilite’s;
    • Edit include/config.h
    • Change /* #define STATUS_VIA_WINDOWPORT */ to #define STATUS_VIA_WINDOWPORT
    • Change /* #define STATUS_HILITES */ to #define STATUS_HILITES
  • sh ./sys/unix/setup.sh sys/unix/hints/linux (sets up the Makefiles correctly)

Build & install

  • make all
  • sudo checkinstall (will create a package and install it for you)
    • Hit y to create default docs
    • Enter nethack 3.6.0 then hit <Enter> twice when prompted
    • At the options screen, change option 12 to say nethack-common. This avoids accidentally installing any old version from your package manager.
    • Hit <Enter> to continue
    • If you see an error “Some of the files created by the installation are inside the home directory“;
    1. Hit n (it’s just a temporary file), then
    2. Hit y to continue (we do not want those files in our package).

Uninstallation

To uninstall, use your favourite package manager, or sudo dpkg -r nethack.

Play!

Now you can run the game via nethack.

Need some help getting starting with nethack? Read the v3.6.0 guidebook.

Tagged , , , ,

Inserting a function into all classes in a directory via Terminal

Or; Multi-line Search and Replace regular expression on the Command Line.

The situation

You have a single abstract class which is extended multiple times in 10 or 100 different classes throughout your codebase.

You’ve found a need for a new abstract method which all classes must now implement.

The problem

Who wants to manually insert that new code into all those classes!? (I don’t).

We need an automated way to do this
Continue reading

Tagged , , , , , , ,

Testing Cron Jobs for the correct user

Testing Cron Jobs in Linux can be a pain – especially if you’re using a tool like CPanel which abstracts away some of the processing. However, with a couple of quick commands, it’s possible to track down where your cron jobs may be failing and get them running smooth as silk.
Continue reading

Tagged , , ,

The Terminal 101

What is the Terminal?

The Terminal is simply a way to execute commands and to view the files on your computer. It is very similar to the Graphical User Interface that allows you to click around and shows you icons of files. The Terminal, however, is a text only environment.

The text only environment is a common source of frustration as it can often times be hard to see why a command didn’t work (eg; a typo), or know exactly which directory you’re in, or any number of other new concepts for first time users of the Terminal. Continue reading

Tagged ,