send man page to text file

Printing a manpage to a text file (perhaps more portable for cross-platform or bedtime reading):

generic Unix/Linux, using `col`:
man rcs | col -b > /tmp/man_rcs.txt

These alternatives would require that you reset PAGER or MANPAGER:
alternative BSD :
export MANPAGER=cat
man pf.conf > man_pf.conf.txt

alternative BSD :
export PAGER=cat
man pf.conf > man_pf.conf.txt

Ubuntu, Debian, Mint, etc. allow all of these alternatives:

-P pager, --pager=pager
Specify which output pager to use. By default, man uses pager -s. This option overrides the $MANPAGER environment variable, which in turn overrides the $PAGER environment variable. It is not used in conjunction with -f or -k.

recovering a complete config from rancid

From time to time, I need to access a complete config stored by the rancid application under CVS, so I can get a good look (more than just the line diffs) at the configuration.

Here are the steps I use to recover an older version of configuration stored by the rancid process in a CVS structure.


1) Find the group that contains the config you want, and get the ‘CVSROOT’ directory info contained in the Root file. This should be in a directory that corresponds to the rancid base install directory — BASEDIR/var/GROUPNAME/configs/CVS/Root. My install base is /usr/local/rancid, so to get a config from my atlanta-zone5 group, I need to look in /usr/local/rancid/var/atlanta-zone5/configs/CVS/Root.

e.g.,
$ cat /usr/local/rancid/var/atlanta-zone5/configs/CVS/Root

2) Next, set and export the CVSROOT variable that you found in step 1.

e.g.,
$ export CVSROOT=/usr/local/rancid/var/CVS

3) Find the version of the file (the configuration revision) you want to get back. This can be done with various CVS front ends, or the command line. For the command line CVS command, go to the configs directory of the group containing the router/switch config you want, then use the ‘cvs log’ command. For example:
$ cd /usr/local/rancid/var/CVS/atlanta-zone5/configs/

4) Look through the log for the version that corresponds to the date you need:
$ cvs log bgp2-rtr | more

5)Go to the directory in which you’ll expand the old config.
$ cd /tmp (or some other directory where you won’t collide with existing files)

6) Check out the version you need using the ‘cvs co’ command in this form:

$ cvs co -r 1.21 GROUP/configs/YOUR_ROUTER
e.g.,
cvs co -r 1.21 atlanta-zone5/configs/bgp2-rtr

The group directory will be restored, and you will have to descend into it to find the exact config you need.

$ cd atlanta-zone5/configs
$ more bgp2-rtr

7) Enjoy your recovered config. Repeat as necessary.

pink noise

Pink noise can be used to mask distracting sounds in the environment around you. It can be useful for providing a neutral sonic background for concentration.

The program speaker-test comes in the alsa-utils package, and provides pink noise by default. This is described by its man page as “perceptually uniform noise”. There are a number of other options, but for a quick noise generator, speaker-test is very handy.

Command line fun for linux : included utilities

obelix@entity:~$ info util-linux-ng

What’s my ubuntu (or debian) version?

I have a  number of machines running various OS releases. Sometimes I need to check what flavor or relase I’m running on the current machine.
While uname -a will show the Linux kernel version, there are a few ways to get more information.
Here are three possibilities:
cat /etc/issue
cat /etc/lsb-release

and my favorite:
lsb_release -a

Here’s some sample output from lsb_release:
$ lsb_release -a
LSB Version: core-2.0-ia32:core-2.0-noarch:core-3.0-ia32:core-3.0-noarch:core-3.1-ia32:core-3.1-noarch:core-3.2-ia32:core-3.2-noarch:core-4.0-ia32:core-4.0-noarch
Distributor ID: Ubuntu
Description: Ubuntu 10.04.1 LTS
Release: 10.04
Codename: lucid

The “lsb” in these commands refers to the Linux Standard Base.  For more information, see the Linux Foundation .

lucidor

I’ve been looking at a number of different ebooks and e-readers lately.  Lucidor is a project which is a little better looking than some of the older apps, but it is still pretty early in development.

Here’s a copy of lucidor 0.9, which was difficult to find due to problems with the lucidor site:

lucidor_0.9-1_all.deb

md5sum:  08faa6b60df2dae654e70431aa2e7626  lucidor_0.9-1_all.deb.gz
sha1sum: 0397853f5c4fe013fe36aed71ec0aa219f7f35f2  lucidor_0.9-1_all.deb.gz

installing the development version of the sphinx documentation tool

Get the latest version from bitbucket:

$ hg clone http://bitbucket.org/birkenfeld/sphinx

The remainder of the instructions are based on the README, but details will vary according to what package dependencies need to be met. That is, some additional packages beyond what is described here may need to be installed.
Change to the new directory, build, and install.

cd sphinx
python setup.py build
sudo python setup.py install

Build sphinx’s documentation with sphinx:

cd doc
sphinx-build . _build/html

And, that should do it.

Also see the bitbucket sphinx wiki .

installing ntop on Ubuntu : problem with rrd directories

The ubuntu install for ntop is broken without some additional steps.

‘Ubuntu Bloke’ had the easy fix :

"Create the directories that for some reason are not created by the installer
sudo mkdir /var/lib/ntop/rrd
sudo mkdir /var/lib/ntop/rrd/graphics
sudo mkdir /var/lib/ntop/rrd/flows
sudo mkdir /var/lib/ntop/rrd/interfaces
sudo mkdir /var/lib/ntop/rrd/interfaces/eth0
sudo mkdir /var/lib/ntop/rrd/interfaces/ppp0
sudo chmod -R 775 /var/lib/ntop"

Cisco 3560, 3750 archive command to install or upgrade IOS via tar file

Some newer L3 Cisco switches are now happier if you use the ‘archive’ facility to manage images.
If you only want the IOS, and not the web interface and so on, use the /imageonly flag.
From the Cisco release notes :
For example:
Switch# archive download-sw /overwrite tftp://198.30.20.19/c3750-ipservices-tar.122-50.SE.tar

Check the release notes or command reference (or in-exec help) for further options.

This apparently does away with ‘boot system statements’ as well, as you can see if you run ‘show boot’ on the switches. The image set by your ‘archive’ command becomes the active image on reboot.  I’m not sure what happens if you have both explicit ‘system boot <blah>’ statements and the automatic IOS precedence setting configured via the fancy archive method.

anynode#sh boot
BOOT path-list : flash:c3750-ipservicesk9-mz.122-53.SE1/c3750-ipservicesk9-mz.122-53.SE1.bin
Config file : flash:/config.text
Private Config file : flash:/private-config.text
Enable Break : no
Manual Boot : no
HELPER path-list :
Auto upgrade : yes
Auto upgrade path :
Timeout for Config
Download: 0 seconds
Config Download
via DHCP: disabled (next boot: disabled)
-------------------

DreamPie Python editor

I’ve been trying out the DreamPie python editor, and it looks promising.  It’s free, GPLv3.

I just added an entry for it at http://wiki.python.org/moin/PythonEditors :

  • DreamPie (sourceforge)
  • Works on Windows, Linux and Mac. (Mac support requires MacPorts .)
  • Interactive shell with history box and code box, auto-completion of attributes and file names, auto-display of function arguments and documentation. Keeps your recent results, provides session history saving (optionally in HTML), interactive plotting with matplotlib. Extremely fast and responsive. GPL3 .

Next Page »