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.

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 .

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"

converting a pdf into html (one file to many method)

Here’s an Ubuntu (and other linux/Unix?) tip taken from ehow .

To convert a pdf into navigable html (with images intact), you can use pdftohtml:

E.g.,

 pdftohtml -c originalfile.pdf  newname_template.html

Converting a book-length pdf using this method gave me a directory full of files, with consecutively numbered html files representing the pages.   Names were based on the ‘newname_template’ supplied, as were the png image files.  Not the prettiest, but functional, and viewable on devices lacking native pdf-rendering capabilities.

linux/Unix tools for multiline grep

grep -A 2 SearchString # find and return SearchString and the two lines after the line that matches
grep -B 3 SearchString # find and return SearchString and the three lines before the line that matches

also,
pcregrep
pcregrep -M ‘a\nb’ files…

Is there a difference between “apt-get purge” vs. “apt-get remove –purge” ?

I was wondering this myself, as the two seemed to do the same thing. Google helpfully turned up a thread from ubuntu-users (Jan. ’09).

This post sums it up well (and accurately, I believe):

>Derek B. writes:
>>Tommy T. wrote:
>>> On Fri, Jan 23 [...] Pierre F. wrote:

>>> hi,
>>> Is there any subtle difference between the 2 syntaxes?
>>> (I couldn’t find the answer in any documentation)

>>
>> Don’t they do different things?
>
>No.