Taming the TerminalThe previous 13 instalments in this series related to networking, but we’re going to change tack completely for this instalment, and look at two un-reltaed, but very useful terminal commands – screen, and cron.

screen is a utility that allows for the creation of persistent virtual terminal sessions that you can disconnect from without terminating, and reconnect and pick up where you left off at a later time. screen is particularly useful when used in conjunction with SSH.

cron on the other hand is a system for automatically executing recurring tasks. It’s extremely flexible, and very useful for things like scheduling backups to run in the middle of the night.

Read more

Tagged with:

This post is part 17 of 35 in the series Programming by Stealth

At this stage in the series we have made very good progress towards understanding the core JavaScript language. However, there is still one very important piece missing – objects. We have mentioned them in passing in almost every instalment, and each time, we put them off until later. We finally remedy that in this instalment.

Read more

Tagged with:

While it’s very easy to install hsxkpasswd onto your system from CPAN – it’s literally just one command (see below) – it requires administrator access to the machine.

sudo cpan Crypt::HSXKPasswd

This is all well and good if you have administrator access and are sure you want the module installed system-wide. But, what if you don’t have admin access, or, what if you just want to experiment with the module in your own home directory? The answer is perlbrew, a system for running custom versions of Perl inside your home directory. No need for sudo, and what ever you install with perlbrew is entirely contained within your home directory. If you already have perlbrew installed and configured with a version of Perl greater than or equal to 5.16, you can skip to the final step. If not, you’ll need to make your way through all the steps.

Step 1 – Install perlbrew Into Your Home Dir

There are a few different ways of installing perlbrew, but I find the following method the simplest:

curl -L http://install.perlbrew.pl | bash

That should install perlbrew into your home directory, and it should tell you to append some code to the end of your ~/.bash_profile file, which you can do with the following command:

echo 'source ~/perl5/perlbrew/etc/bashrc' >> ~/.bash_profile

Once that’s done, close your Terminal window and open a new one (this is to pick up the new environment variables defined in ~/perl5/perlbrew/etc/bashrc). You’ll know the install has been successful if you can run the perlbrew command:

perlbrew version

Step 2 – Install a Compatible Version of Perl into perlbrew

The joy of perlbrew is that you can have as many versions of Perl installed at any one time as you like, and you can then switch between them with the perlbrew command.

You can install Crypt::HSXKpasswd, and hence the hsxkpasswd terminal command, into any version of Perl greater than or equal to 5.16.

The following command will install Perl 5.16 into perlbrew:

perlbrew install perl-5.16.0

Go off and make yourself a cup of your favourite beverage – this will take a while! 🙂

Once the install finally finishes, you can activate that version of perl (just on your account) with the command:

perlbrew switch perl-5.16.0

It’s important to note that if at any stage you want to disable perlbrew and get back to the default system version of perl, the command to do so is:

perlbrew off

Step 3 – Enable the perlbrew CPAN Client

If you haven’t already done so, enable the perlbrew CPAN client cpanm with the command:

perlbrew install-cpanm

Step 4 – Install Crypt::HSXKPasswd

Once you have perlbrew installed and configured with a compatible version of perl, you can install Crypt::HSXKPasswd with the following simple command:

cpanm Crypt::HSXKPasswd

You’ll know it’s worked if you can run the hsxkpasswd terminal command:

hsxkpasswd --version

Tagged with:

This is the second part of a two-part post – read part 1 here.

In part 1 we learned how to use the command line too hsxkpasswd to generate passwords, and how to use various flags to specify custom password generation configurations, and word sources. In this second part we’ll look at how to save these customisations for future use with .hsxkpasswdrc files.

Read more

Tagged with:

Since version 3.5, the Crypt::HSXKPasswd password generating perl module ships with a command line interface to the password generator called hsxkpasswd. This provides a way for non-Perl programers to access the vast majority of the module’s functionality.

The easiest way to install the module, and it’s accompanying terminal command is via CPAN:

sudo cpan Crypt::HSXKPasswd

Once the module is installed, you’ll have access to the hsxkpasswd terminal command.

Getting started is simple, run the command with no arguments at all and it will generate one password using the default settings:

bart-iMac2013:~ bart$ hsxkpasswd
@@26.MEASURE.below.LIFT.95@@
bart-iMac2013:~ bart$

If you want more passwords, pass a number as an argument, and you’ll get that many passwords:

bart-iMac2013:~ bart$ hsxkpasswd 10
~~08!hole!VOWEL!then!45~~
$$49^monday^YELLOW^remember^22$$
//69-express-MONDAY-edge-54//
--42~KITCHEN~save~COLD~40--
==51%REPLY%even%AUGUST%28==
%%63&list&INSIDE&train&58%%
^^19!spain!CONGO!spain!01^^
::30@SMILED@from@PERIOD@90::
&&05%decimal%THREE%remember%80&&
..47^ROAD^dress^BERLIN^11..
bart-iMac2013:~ bart$

Read more

Tagged with:

Firstly, thanks to everyone who runs beta versions of Crypt::HSXKPasswd – every bug you find makes the software that little bit better!

However, now that the software is in CPAN, many of you may well want to move away from the stand-alone beta releases, and start getting the module directly from CPAN. Before you install the module from CPAN, you should remove the beta from your system. You can do that in two easy steps:

  1. Install pm-uninstall from CPAN: sudo cpan App::pmuninstall
  2. Use pm-uninstall to remove the beta version of Crypt::HSXKPasswd: sudo pm-uninstall Crypt::HSXKPasswd

Tagged with:

Taming the TerminalThe previous instalment we introduced the HTTP protocol. In this instalment we’ll look at three terminal commands which make use of the HTTP protocol.

We’ll start by browsing from the terminal, and then move on to a pair of very similar commands for making HTTP requests from the terminal. These two commands can do many things, but we’ll focus on two specific use-cases, downloading files, and viewing HTTP headers.

Read more

Tagged with:

Taming the TerminalIn the previous instalment we finished a five-part series on SSH. Before moving on, lets take a moment to step back and look at the big-picture. The five SSH instalments are all part of the now long-running series on networking. We have been working our way through the networking stack since instalment 23. We started at the bottom of the stack, and have worked our way up. We are not exploring protocols in the Application Layer.

In this instalment we’re moving on from SSH to HTTP, the protocol that powers the world wide web.

Before we look at some HTTP-related terminal commands, we need a basic understanding of how HTTP works, so that’s what this instalment is all about.

Read more

Tagged with:

Taming the TerminalThis is the final SSH instalment. So far we’ve learned how to securely execute terminal commands on remote computers, how to securely copy files across the network using SSH, how to add both security and convenience to both those operations with SSH key pairs, and how to tunnel just about anything through SSH. In this final instalment we’ll look two approaches for creating SSH bookmarks, SSH config files, and SSH GUIs.

Read more

Tagged with:

Taming the TerminalThis is the fourth SSH instalment. So far we’ve learned how to securely execute terminal commands on remote computers, how to securely copy files across the network using SSH, and how to add both security and convenience to both those operations with SSH key pairs.

As we saw in the previous instalment, SSH’s ability to provide a secure connection between two computers can be used in many different ways. In this instalment we’ll learn about three more ways to encapsulate other network traffic within an SSH connection, adding encryption to that traffic.

Running commands and copying files are the kinds of things most people do, so the three SSH instalments to date have been quite generally applicable. That is not the case for this instalment. The three SSH features we’ll be discussing are all very useful to those who need them, but only a minority will have a use for any one of these features. However, even if you don’t need these features today, I would argue that it’s good to know these features exist, because they could well solve a problem you’ll have in the future.

There will be illustrations of the uses for these technologies, but not commands you type into your terminal to play along at home. That makes this an unusual instalment, but I hope you will still find it worthwhile.

Read more

Tagged with:

keep looking »