Transcription of Linux and Other Notes


Setting up Ubuntu: first thing

The first thing to do on Ubuntu after you get it up and running (I didn't find I had to do this prior to Lucid, but I read on-line that others have had to as far back as Feisty or even Edgy) is to fix the mapping of sh. Do this or the equivalent from root:

	root@tuonela:/> rm /bin/sh
	root@tuonela:/> ln -s /bin/bash /bin/sh

You only need to do this if sh isn't just a link to bash. Why do you need to do this? Because you'll be missing important functionality such as pushd when you write and execute shell scripts. pushd will be reported as not found. And it doesn't matter that your script's first line is #!/bin/bash, it still will go missing.


Now down to business: .bashrc and .bash_profile

It's important to get this bit right: .bashrc is executed every time a new shell is created. Open a new terminal window, it's executed.

.bash_profile, on the other hand, is executed only once at log-in. This means that if you're going to add a path to PATH, this is the place to do it. Otherwise, if you add, say your personal script and executable subdirectory to the end of PATH in .bashrc, then after a while you're going to see that PATH has got a huge number of instances of "~/bin" tacked onto the end of it. This is not what you want.


How to set your prompt in bash

To customize your prompt, see man bash and search for “PROMPTING” where you will see a bunch of specifiers. My prompt on Tru64 is established thus...

	PS1="\u@vastru64:\w> "

This shows up as:

	rbateman@vastru64:~/vgp-3.1.1/src> (first command-line character comes here)


Grub menu management...

I mistakenly created a bad kernel that became the default to which grub would boot (automatically). In figuring this out, I discovered not only how to eliminate the bad kernel, but also how to manage the grub menu.

Menu

This is as straightforward as it appears in the file /boot/grub/menu.lst: just eliminate the entries that don’t rhyme with what you want, reorder them, etc. and change the default at the top of this file to the 0-based nth item you want to be the default. The timeout is, of course, the number of seconds without interaction until the default is taken with confirmation.

	# Modified by YaST. Last modification on Fri May 18 16:39:17 MDT 2007
	default 2
	timeout 8
	gfxmenu (hd01)/boot/message

	title openSuSE 10.2 - 2.6.18.8-0.3
	   root (hd01)
	   kernel /boot/vmlinuz 2.6.18.8-0.3-default root=/dev/sda vga=0x31a showopts \
	      ide=normal apm=off noresume nosmp noapic maxcpus=0 edd=off
	   initrd /boot/initrd-2.6.19.8-0.3-default

	title Failsafe -- openSuSE 10.2 - 2.6.18.8-0.3
	   root (hd01)
	   kernel /boot/vmlinuz 2.6.18.8-0.3-default root=/dev/sda vga=normal showopts \
	      ide=nodma apm=off acpi=off noresume nosmp noapic amxcpus=0 edd=off
	   initrd /boot/initrd-2.6.19.8-0.3-default

	title openSuSE 10.2
	   root (hd01)
	   kernel /boot/vmlinuz root=/dev/sda vga=0x31a resume=/dev/sda1 splash=silent showopts
	   initrd /boot/initrd-2.6.19.8-0.3-default

	title Floppy
	   rootnoverify (hd0.0)
		 chainloader (fd0)+1
	.
	.
	.

The booting kernel...

In the directory above, /boot, two links, initrd and vmlinuz, need to be made to the corresponding files of the kernel you list as default in the menu. In my case, because I was tossing the last kernel I mistakenly built (and that didn’t work), I had to redo these links. Now I’m set because my box comes up and by default chooses the right kernel, the one with the latest NVIDIA driver linked in to support my 20" wide-aspect monitors.


So, despite all the training films and lectures...

...you’ve gone and gotten your PAM files hosed and can no longer get into your box.

See What to do if you’ve hosed your PAM files.


20070516-103219 CD 1

Satori says:

There is an additional CD for non-OSS packages:
http://download.opensuse.org/
It’s called the Addon...
You may be able to install via yast by adding http://download.opensuse.org/distribution/10.2/repo/non-oss/...
...as an installation source.

Russ at Vintela says:

Ah, okay, I’ll try that too. (I’m downloading the iso and planned on mounting it on a loop-back.)

Satori says:

Yep, that too!

Linux command to list PCI devices...

From /sbin, use lspci to get a list of PCI devices, their names, model numbers, etc. For example, on my SuSE host on IBM hardware, I have the following video card:

	russ@taliesin:~> /sbin/lspci | grep VGA
	01:00.0 VGA compatible controller: nVidia Corporation NV44 [GeForce 6200 TurboCache(TM)] (rev a1)

This way, I now know that I’m running an NVIDIA 6200 and can communicate that to someone else who wants to know a good card to get that will sustain two monitors.

lspci -v gets you more still.


Linux config script...

Most packages (products, software, projects, etc.) that you encounter that are of any consequence have an associated script that’s dang handy for what it does. It’s called the “config” script. I’m not talking about the one you run before typing make (in fact, I consume it from configure.ac as I will show in a moment), but what you distribute with your product so that consumers can inquire about fundamental and crucial aspects of your product including where it’s installed, where its associated header files and libraries are (if any), the prefix to the root of where these things might be happening, etc.

For example, where is PHP on your box? On Windows, I used to type “whereis something” to find whether it existed on PATH. On Linux I have often typed “which something” to the same effect. However, typing php-config yields:

	russ@taliesin:~> php-config
	Usage: /usr/local/bin/php-config [--prefix|--includes|--ldflags|--libs|--extension-dir|--version]

(In PHP’s case, you can’t type more than one of these arguments at once, but our product’s version of this script, vas-config, does handle it giving each piece of information on subsequent new lines.)

For example, invoking with the --includes option yields very complex, but crucially useful information (to me who am working on PHP bindings for my product):

	russ@taliesin:~> php-config --includes
	-I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend

This is what I use in my configure.ac (autoconfig) script to set up where gcc will get PHP headers from. And so on.


Linux GUI to text console...

^ alt F1 drops to the text console.

^ alt F7 returns to GUI.

Note that if the GUI log-in is “hung,” meaning you can’t type in a username, you can press ^ alt F1 to get to the text console, log in as root, then, as you’re already at level 5 (most likely: you were running in GUI after all), reinit to level 3, then to level 5 whereupon you’ll get a new GUI:

	taliesin:~ # init 3
	(bunch of stuff happens here: press Enter a few times...)
	taliesin:~ # init 5
	(wait a while)

How to salvage my Linux host...

If I delete VAS or otherwise corrupt it, I may be left with the PAM files in such a state that I can’t log in, get root, etc. The steps to reversing this are:


How to run wireshark...
	taliesin:/home/russ/VAS/src/preflight # sudo wireshark &*

To see what’s going on on port 88, go to

Then use/reuse Capture->Start, Stop or Restart and see the pretty colors.

* If you get an error like

	russ@taliesin:~/VAS/src/preflight> sudo wireshark &
	[3] 23994
	russ@taliesin:~/VAS/src/preflight>
	(wireshark:23994): Gtk-WARNING **: cannot open display:

	[3]+  Exit 1                  sudo wireshark

Try this instead:

	taliesin:/home/russ/VAS/src/preflight # gnomesudo wireshark &

You can't run wireshark unless you are root. On Ubuntu or other systems, you might find the working GUI sudo command to be something like gksudo.

On openSuSE Linux 10.3, I'm finding that the command is gnomesu -c wireshark &.

An example

Upon launching wireshark, I pull down the Capture menu, choose Options..., then ensure that the Interface is eth0 (my network card).

I then specify a filter. The filter syntax appears inconsistent between the various places you can set on in wireshark. In one case where I was attempting to sniff HTTP exchanges between two applications I was testing, I set the Interface to lo (meaning local or 127.0.0.1) and then used tcp port 48080.

Then, click on the Start button and the fun begins. (You're on your own now.)


Using iptables to block ports...

It’s useful to block ports when testing to observe behavior in failure. Some iptables commands to block UDP port 88 from out-going use.

See what's in place:

	iptables -L OUTPUT

Insert a rule at the head (before rule 1) of the table:

	iptables -I OUTPUT 1 -d ad-u.u.vas -p upd --dport 88 -j DROP

Add a rule at the end of the table:

	iptables -A OUTPUT -d ad-u.u.vas -p udp --dport 88 -j DROP
	iptables -A OUTPUT -d ad-u.u.vas -p tcp --dport 88 -j DROP

Important! Rules are implemented in-order. So, if there's a rule like...

	taliesin:/home/russ/VAS/src/preflight # iptables -L OUTPUT
	Chain OUTPUT (policy ACCEPT)
	target     prot opt source       destination
	ACCEPT     0    --  anywhere     anywhere
	DROP       udp  --  anywhere     AD-U-u.vas        udp dpt:kerberos

...then adding a rule to block UPD port 88 will have no effect! Instead, insert it before the first rule.

Delete rule 4 from the table by number:

	iptables -D OUTPUT 4

Some good links...


Synthesis: an example using iptables and wireshark
	taliesin:/home/russ # iptables -I OUTPUT 1 -p udp --dport 88 -j DROP
	taliesin:/home/russ # iptables -L OUTPUT Chain OUTPUT (policy ACCEPT)
	target     prot opt source       destination
	DROP       udp  --  anywhere     anywhere    udp dpt:kerberos
	ACCEPT     0    --  anywhere     anywhere
	ACCEPT     0    --  anywhere     anywhere    state NEW,RELATED,ESTABLISHED
	LOG        0    --  anywhere     anywhere    limit: avg 3/min burst 5 LOG level warning tcp-options ip-options prefix `SFW2-OUT-ERROR '
	taliesin:/home/russ # wireshark &
	      Instructions for Wireshark:
	      1. Capture -> Options
	      2. Capture Filter: port 88
	      3. Start
	      4. watch what happens... (nothing)

	russ@taliesin:~/HEAD/VAS/src/preflight> vastool kinit
	Password for administrator@A.VAS:
	ERROR: Could not establish credentials.
	VAS_ERR_KRB5: at ticket.c:77 in _ticket_generate_good_error
	   Failed to obtain credentials. Client: administrator@A.VAS, Service: krbtgt/A.VAS@A.VAS, Server: ad64-a.a.vas
	   Caused by:
	   KRB5_KDC_UNREACH (-1765328228): Cannot contact any KDC for requested realm
	Reason: unable to reach any KDC in realm A.VAS
	taliesin:/home/russ # iptables -D OUTPUT 1

dir /o:d

To sort files in ascending order by date...

	rbateman@vastru64:~> ls -lart


sort

To sort lines of a file on a particular field, check out man page for...

	rbateman@vastru64:~> sort -k


How much memory? top

How much memory is being consumed on system? How much total? Etc. top is dynamic; you have to stop it.

	russ@taliesin:~> top
	top - 14:31:57 up  1:47,  4 users,  load average: 8.72, 4.35, 1.76
	Tasks: 118 total,   1 running, 117 sleeping,   0 stopped,   0 zombie
	Cpu(s):  0.7% us,  9.8% sy,  0.0% ni,  0.0% id, 88.3% wa,  0.2% hi,  1.0% si
	Mem:   1033484k total,  1019936k used,    13548k free,    10060k buffers
	Swap:  1052216k total,     3332k used,  1048884k free,   732760k cached

	  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
	 9547 russ      18   0  2828  968  752 D 14.0  0.1   0:24.68 snhelper
	  523 root      15   0     0    0    0 S  4.7  0.0   0:07.29 kswapd0
	 5989 root      15   0  175m  41m 8560 S  0.7  4.2   0:31.17 X
	 7132 russ      15   0 57472  18m 9288 S  0.7  1.8   0:04.66 gnome-terminal
	 8631 russ      15   0 71596  30m  16m S  0.7  3.0   0:03.64 vmware-server-c
	 6096 russ      16   0 81040  37m  14m S  0.3  3.7   0:12.37 mono
	 6155 russ      16   0 98.5m  30m  19m S  0.3  3.0   0:09.11 mono
	    1 root      16   0   688  260  224 S  0.0  0.0   0:01.17 init
	    2 root      RT   0     0    0    0 S  0.0  0.0   0:00.01 migration/0
	    3 root      34  19     0    0    0 S  0.0  0.0   0:00.00 ksoftirqd/0
	    4 root      RT   0     0    0    0 S  0.0  0.0   0:00.00 migration/1


How much disk space? df

How much disk space is used up on system? How much total? Etc. Some examples:

	russ@taliesin:~> df
	Filesystem           1K-blocks      Used Available Use% Mounted on
	/dev/sda2             77101576  23483332  53618244  31% /
	tmpfs                   516740         0    516740   0% /dev/shm

	russ@taliesin:~> df -h
	Filesystem            Size  Used Avail Use% Mounted on
	/dev/sda2              74G   23G   51G  31% /
	tmpfs                 505M     0  505M   0% /dev/shm

	windofkeltia:/home # df -h
	Filesystem            Size  Used Avail Use% Mounted on
	/dev/hda2              34G  5.5G   28G  17% /
	udev                  506M   96K  506M   1% /dev
	/dev/hdc1              96G   33M   96G   1% /home2
	/dev/hdb1             112G  4.4G  108G   4% /home

	windofkeltia:/home # ./diskspace.sh hdb1
	Filesystem on disk: /home (device: /dev/hdb1)
	   Total disk size: 112Gb
	        Used space: 4.4Gb (4%)
	        Free space: 108Gb

The diskspace.sh script that produced the output above is:

	#!/bin/sh

	DISK=$1

	if [ -z "$1" ]; then
	  echo "Usage: $0 "
	  echo "  ERROR: You must supply the device name of the disk."
	  exit -1
	fi

	which=`df -h | grep $DISK`

	if [ -z "$which" ]; then
	  echo "No device $DISK exists."
	  exit -1
	fi

	# Example:
	# /dev/hdc1   96G   33M   96G   1% /home2

	 device=`echo $which | awk '{ print $1 }'`
	   size=`echo $which | awk '{ print $2 }'`
	   used=`echo $which | awk '{ print $3 }'`
	   free=`echo $which | awk '{ print $4 }'`
	percent=`echo $which | awk '{ print $5 }'`
	   path=`echo $which | awk '{ print $6 }'`

	echo "Filesystem on disk: $path (device: $device)"
	echo "   Total disk size: ${size}b"
	echo "        Used space: ${used}b ($percent)"
	echo "        Free space: ${free}b"

And, here's the superduper version that does all the disk devices if you don't specify which one interests you:

	#!/bin/sh

	DISK=$1

	DoDiskSpace()
	{
	  DISK=${1:-}

	  if [ -n "$DISK" ]; then
	    # Example:
	    # /dev/hdc1   96G   33M   96G   1% /home2

	    which=`df -h | grep $DISK`

	     device=`echo $which | awk '{ print $1 }'`
	       size=`echo $which | awk '{ print $2 }'`
	       used=`echo $which | awk '{ print $3 }'`
	       free=`echo $which | awk '{ print $4 }'`
	    percent=`echo $which | awk '{ print $5 }'`
	       path=`echo $which | awk '{ print $6 }'`

	    echo "Filesystem on disk: $path (device: $device)"
	    echo "   Total disk size: ${size}b"
	    echo "        Used space: ${used}b ($percent)"
	    echo "        Free space: ${free}b"
	  fi
	}

	if [ -n "$1" ]; then
	  case "$1" in
	    "-h" | "--help")
	      echo "Usage: $0 [-h] []"
	      echo "  --with no argument, you get all of the disk devices."
	      exit 0
	      ;;
	    *) DoDiskSpace $1
	      ;;
	  esac
	else
	  # Get a list of disk devices and run it (do all of them).
	  devices=`df | grep ^ | awk '{ print $1 }'`
	  for which_device in $devices; do
	    if [ "$which_device" != "Filesystem" ]; then
	      DoDiskSpace `basename $which_device`
	    fi
	  done
	fi
	# vim: set tabstop=2 shiftwidth=2 noexpandtab:

More how much disk space? du

Use the du command with --max-depth=n to control the depth of the analysis. For example, how much diskspace are the following web site users consuming. (Some are not web sites.)

	windofkeltia:/home # du --max-depth=1 -h
	292K    ./svn
	100M    ./sonsofutahpioneers
	50M     ./utahwoodturners
	1.4M    ./pfssd
	296K    ./silvertipexpress
	3.5M    ./quicklang
	2.1M    ./morselives
	32M     ./timpwoodturners
	53M     ./russcooks
	27M     ./stgeorgetemplevisitorscenter
	505K    ./cotton
	90M     ./provotabernacle
	1.6G    ./rbateman
	0       ./bullheadranch
	13M     ./vanordenfamily
	101K    ./julene
	2.7M    ./kkearl
	13M     ./utahsdixie
	6.1M    ./covefort
	1005K   ./aintnoclouds
	101K    ./randybateman
	5.1M    ./etretatlogiciels
	81M     ./vicback
	18M     ./nuttall
	614M    ./alfredbateman
	1.2G    ./windofkeltia
	789K    ./wcpafug
	3.3M    ./stgeorgelive
	93K     ./rmbateman
	71M     ./russbateman
	161K    ./sfranson
	4.6M    ./dixiecommunications
	548M    ./russellbateman
	101K    ./krbeesley
	4.4G    .

Who am I?

Use this command to find out information:

	russ@taliesin:~> id
	uid=1000(russ) gid=100(users) groups=16(dialout),33(video),100(users)


scp

In place of ftp, which for security reasons many hosts no longer permit, use scp:

	russ@taliesin:~> scp russellb@jerry.vintela.com:/data/vas/dev-isos/Isos-vas_vgp-VAS_3_0_0_25/VAS-site-3.0.0-25.iso .

Unable to get into a remote machine because of warning that “Remote host identification has changed!”? Edit ~/.ssh/known_hosts and remove the entry (it’s one long and wrapped line) corresponding to the host you wish to get into.

Of course, if the remote host isn’t joined to vintela.com, russellb simply won’t work.


ssh

Use ssh to get a console on another host than your own (or, even on your own if it serves you to do so):

	russ@taliesin:~> ssh -l username hostname.domainname

Example:

	russ@taliesin:~> /usr/bin/ssh -l russellb solaris8.vintela.com


tar

Sample, common tar commands: to create (c) an archive, to extract (x) it, and to see (t for “titles’) what’s in it without extracting anything...

	russ@taliesin:~> tar -cvf tar-filename files and directories...
	russ@taliesin:~> tar -xvf tar-filename
	russ@taliesin:~> tar -tvf tar-filename


gzip and gunzip

Sample gzip command. Note that gzip’s output is usually on stdout which is then redirected to the desired output file. For gunziping what is known as a “tarball,” see tarballs.

	russ@taliesin:~> gzip -c filename.tar > filename.tar.gz


tarballs

Use gunzip to decompress tarballs (filename.tar.gz):

	russ@taliesin:~> gunzip -d filename.tar.gz
	russ@taliesin:~> tar -xf filename.tar

Or, simply use the -z to tar:

	russ@taliesin:~> tar -xfz filename.tar.gz


rpm

To install a package or to see if a package is installed:

	russ@taliesin:~> rpm -i file.rpm
	russ@taliesin:~> rpm -qa | grep package-sought

With a down-loaded package in hand, to see what is inside and where it will be installed (including binary’s name) or, if not installed (remove the p option):

	russ@taliesin:~> rpm -qilp package-name
	russ@taliesin:~> rpm -qil  package-name

Thus, for VMware Console package, VMware-console-2.5.2-16390.i386.rpm, which is already installed on my box, I type:

	russ@taliesin:~> rpm -qil VMware-console

...and the result is:

	/etc/vmware-console
	/etc/vmware-console.sh
	/usr/bin
	/usr/bin/vmware-console
	/usr/lib/vmware-console
	/usr/lib/vmware-console/bin
	/usr/lib/vmware-console/bin-debug
	/usr/lib/vmware-console/bin-debug/mks
	...

Download the VMware console for use on SuSE 10 from here at VMware-console-2.5.2-16390.i386.rpm. Right-click on this link, choose, Save link as..., etc. To install it, you use rpm, then a Perl script distributed with it. You can usually invoke it right from /tmp without going looking for it; it lives in /usr/bin/vmware-config-console.pl). Take the default when prompted.

	russ@taliesin:~> su
	Password:
	taliesin:/home/russ: # cd /tmp
	taliesin:/tmp # rpm -e VMware-console-2.5.2-16390.i386.rpm
	taliesin:/tmp # vmware-config-console.pl
	taliesin:/tmp # exit

And I see that I’m probably going to find vmware-console at /usr/bin because that’s in my PATH shell variable.

Not all Linices make use of rpm. Debian, for example, uses something named apt. To use it, you have to know the name of a package, then type the command:

	russ@taliesin:~> apt-get install package-name

Other commands include (see http://www.debian.org/doc/manuals/apt-howto/)...

	russ@taliesin:~> apt-get remove package-name         (leaves configuration files)
	russ@taliesin:~> apt-get --purge remove package-name (removes even configuration files)
	russ@taliesin:~> apt-get -u upgrade                  (upgrade packages)
	russ@taliesin:~> apt-get -u dist-upgrade             (upgrade entire system at once)


How to recover packaged software from hosed state...

This is unlikely, but it happens. I was writing a utility to ascertain certain aspects of sshd then give advice about its findings. In the process of deleting temporary files, I accidentally deleted /usr/sbin/sshd itself which gave me no end to trouble as I casually attempted to get along without it (used Quest’s ssh, etc.).

I broke down and tried to impose my original RPM installation, but by a stroke of mind-shattering bizarreness, the one from my original, read-only DVD was bad. So, I found another copy (at rpm.pbone.net) and down-loaded it. Then, I used the following command to reinstall it:

	taliesin:/> rpm -Uvh /tmp/openssh-4.4p1-24.i586.rpm


Solaris package manager...

Along the lines of Linux rpm is the Solaris package manager. I have had to use this in writing a super-duper installation script that covers all platforms.

For example, a site-license installation on a Sun box...

	russ@taliesin:~> pkginfo | grep vasclnt
	application vasclnts             VAS Client (site)


Other *nix platform package managers...

And the others...

AIX

HP-UX


Building stuff from sourceforge...

1. Search for desired software on Google or directly at sourceforge.net, go to the link on source forge and download the tarball into /tmp. The example we’ll use here is vifm.

2. Go to /tmp and decompress the tarball into a simple archive:

	russ@taliesin:~> cd /tmp
	russ@taliesin:/tmp> gunzip -d vifm-0.3a.tar.gz

3. Extract the archive:

	russ@taliesin:/tmp> tar -xf vifm-0.3a.tar

4. Go down into the directory and build it:

	russ@taliesin:/tmp> cd vifm-0.3a
	russ@taliesin:/tmp/vifm-0.3a> ./configure
	russ@taliesin:/tmp/vifm-0.3a> make

5. Go down into the src directory and run it to ensure that it works.

6. If good, go back up one level and do a make install:

	russ@taliesin:/tmp/vifm-0.3a> sudo make install


syslog...

The configuration file is on the path /etc/syslog-ng/syslog-ng.conf. The path to syslog’s output, on SuSE 10 at least, is /var/log/messages. Use the following command to be able to watch it grow at the end:

	russ@taliesin:~> tail -f /var/log/messages

Sample entry lines in the SuSE 10, new-generation syslog, as used by VAS:

	source s_vas { unix_stream("dev/log"); internal(); }
	destination d_russvas { file("/home/russ/vas.$WEEKDAY.$HOUR.$MIN"); }
	filter f_vasauth { facility(auth, authpriv); }
	log { source(s_sys); filter(f_vasauth); destination(d_russvas); }

I don’t know if the above would work. Here is what I really have in my /etc/syslog-ng/syslog-ng.conf file:

	...
	filter f_daemon         { level(debug) and facility(daemon); };
	...
	destination daemondebug { file("/var/log/daemon.debug"); };
	log                     { source(src); filter(f_daemon); destination(daemondebug); };

The system log, /var/log/messages, can grow quite large. Delete it, and touch it to start over.

	rm /var/log/messages
	touch /var/log/messages
	rm /var/log/daemon.debug
	touch /var/log/daemon.debug
	/etc/init.d/syslog restart

Once any change to any of this is made, syslog must be restarted:


libroken.a...

libroken.a means “broken” and contains all the pseudo-standard stuff missing from the build on any given platform. For example, if GNU stuff getargs and arg_printusage aren’t on the platform, this library supplies them.


Stopping or restarting a dæmon...

Find and stop the ssh dæmon or restart it...

	russ@taliesin:~> ps -ef | grep sshd
	russ@taliesin:~> /etc/init.d/sshd stop
	russ@taliesin:~> /etc/init.d/syslog restart

On HP-UX and AIX, this works differently...

	russ@taliesin:~> /sbin/init.d/sshd stop          # (HP=UX)
	russ@taliesin:~> /etc/rc.d/init.d/ssh restart    # (AIX)


Using ps from system to system...

ps options are’t exactly uniform from Linux to UNIX to other Unix. Here’s how it can be solved:

	int is_daemon_running( const char *daemon_name )
	{
	   char ps_command[ 128 ], buffer[ 256 ];

	   /* create ps command for the host platform in 'ps_command'... */
	   cnt = asprintf( &ps_command,

	#if defined( SOLARIS )
	                  "ps -e -o comm | grep [%c]%s"
	#elif defined( DARWIN )
	                  "ps -ax | grep [%c]%s\\\\\\>"
	#else
	                  "ps -e | grep [%c]%s"
	#endif

	                , daemon_name, daemon_name + 1 );

	   if( ( fp = popen( command, "r" ) ) )
	      return errno;

	   while( fgets( buffer, sizeof( buffer ), fp ) )
	   {
	      if( strstr( daemon_name, buffer ) == 0 )
	         return TRUE;
	   }
	   ...
	}


ldd: Which library?

Which libraries does binary sshd link?

	russ@taliesin:~> ldd `which sshd`

If you get...

	russ@taliesin:~> ldd: missing file arguments

It’s certain that there is no sshd on any of your search paths.


Using tail dynamically...

Using the tail of a long, dynamic file (like /var/log/messages):

	russ@taliesin:~> tail -f file


Use umask...

...to put yourself into a state in which every directory or file you create will have, by default, certain privileges although the privileges are slightly different depending on whether a file or a directory for the same umask setting. For the bits, 0 gives you the most rights, rwx for a directory and rw- for a file; 1 gives you rwx for a directory and rw- for a file; 2 gives you r-x and r-- for a file; last, 3 gives you r-- only. For example, ...

	russ@taliesin:~> umask 0
	russ@taliesin:~> touch poop
	russ@taliesin:~> mkdir poop.d
	russ@taliesin:~> ls -l
	-rw-rw-rw-  1 russ users   0 2006-11-01 09:35 poop
	drwxrwxrwx  2 russ users  48 2006-11-01 09:35 poop.d
	russ@taliesin:~> rm poop ; rmdir poop.d

	russ@taliesin:~> umask 0011
	russ@taliesin:~> touch poop
	russ@taliesin:~> mkdir poop.d
	russ@taliesin:~> ls -l
	-rw-rw-rw-  1 russ users   0 2006-11-01 09:35 poop
	drwxrw-rw-  2 russ users  48 2006-11-01 09:35 poop.d
	russ@taliesin:~> rm poop ; rmdir poop.d

	russ@taliesin:~> umask 0022
	russ@taliesin:~> touch poop
	russ@taliesin:~> mkdir poop.d
	russ@taliesin:~> ls -l
	-rw-r--r--  1 russ users   0 2006-11-01 09:29 poop
	drwxr-xr-x  2 russ users  48 2006-11-01 09:29 poop.d
	russ@taliesin:~> rm poop ; rmdir poop.d

	russ@taliesin:~> umask 0033
	russ@taliesin:~> touch poop
	russ@taliesin:~> mkdir poop.d
	russ@taliesin:~> ls -l
	-rw-r--r--  1 russ users   0 2006-11-01 09:35 poop
	drwxr--r--  2 russ users  48 2006-11-01 09:35 poop.d
	russ@taliesin:~> rm poop ; rmdir poop.d

	russ@taliesin:~> umask 0133
	russ@taliesin:~> touch poop
	russ@taliesin:~> mkdir poop.d
	russ@taliesin:~> ls -l
	-rw-r--r--  1 russ users   0 2006-11-01 09:35 poop
	drw-r--r--  2 russ users  48 2006-11-01 09:35 poop.d
	russ@taliesin:~> rm poop ; rmdir poop.d

The usual umask when creating massive numbers of directories (such as for a package installation) is 0022.


Use sudo...

Command sudo executes its argument, a command, in superuser mode:

	russ@taliesin:~> sudo make


Use sux...

Command sux is a wrapper around su that transfers X credentials. This is useful for running GUI apps as root.

	russ@taliesin:~> sux /usr/ConsoleOne/bin/ConsoleOne


The find command...

The find command, an example:

	russ@taliesin:~> find . -name '*.c' -print
	russ@taliesin:~> find / -name 'gcc*' -print
	russ@taliesin:~> find starting at root
	russ@taliesin:~> find . -name '*.c' -exec fgrep -H Usage: {} \;
	russ@taliesin:~> find . -name "*.[ch]" -exec fgrep -H Usage: {} \;	# both .c and .h files

Find some files matching a template; then, finding them, delete them:

	russ@taliesin:~> find . -name '*.tmp' -print
	russ@taliesin:~> find . -name '*.tmp' -exec rm {} \;


newgrp...

newgrp creates a new shell running as if with the gid of the specified group, requires a password created using gpasswd.

Linux (Unix) commands affected or interesting in this context:

	russ@taliesin:~> newgrp new-group-name
	russ@taliesin:~> gpasswd
	russ@taliesin:~> sg                        # (cf. sudo)
	russ@taliesin:~> groups                    # (lists groups from /etc/group)


ctags

Documentation for exuberant ctags can be found at http://ctags.sourceforge.net/ctags.html.

How to build the whole project:

	russ@taliesin:~> cd project-root
	russ@taliesin:~> rm -rf tags
	russ@taliesin:~> ctags -R         (from project root)

Pass -I on command line to ctags to help it know that ARGDECL4 (for example) in the following C code isn’t to be interpreted as a function.

	int foo ARGDECL4( void *ptr, long number, size_t nbytes )

In order to facilitate lots of the above, create $HOME.ctags to contain the list—will be picked up by ctags when it runs.

In vim, type...

      *   go to nearest caller of identifier under/near cursor (SHIFT-8)
      ^]   go to identifier under/near cursor
      ^t   return to previous position from symbol gone to (undo ^])
      [^I   go to prototype of function under/near cursor (same thing as [ TAB)
      ^O   return from prototype gone to (previous cursor position and/or file)

Other movement stuff (I don’t grok yet, but it was in the Vim thread)—some is done in Vim and some in ex. <tag>, here, denotes typing the actual identifier name (a necessity in ex). The first three prompt with a list of possibilities; the rest actually jump to the first in that list. #3 and #6 apparently split off a new window (we’ll have to try this).

      g ^]
      :ts <tag>       (for tselect)
      :sts <tag>
      ^]
      :ta <tag>       (for tag)
      :sta
      <tag> ^t

Snookering ctags into ignoring files that misdirect...

First, why? If you have a header that, during compilation, renames a bunch of functions to something else in order to stave off namespace collisions for whatever reason in your code base, you will find it devilishly frustrating to jump to definitions because of that. It is possible to make ctags ignore any header or source so that its symbol table isn't (similarly) corrupt and ^] will take you to the code just as you’d expect. This can be just a filename or a file listing filenames to be excluded:

	ctags -R --exclude=krb5_sym.h
	ctags -R --exclude=@ctags-exclude    # (see this file below)

	+-- ctags-exclude ----------+
	|   asn1_sym.h              |
	|   ber_sym.h               |
	|   com_err_sym.h           |
	|   des_sym.h               |
	|   gssapi_sym.h            |
	|   krb5_sym.h              |
	|   ldap_sym.h              |
	|   sqlite3_sym.h           |
	|   vers_sym.h              |
	|   ...                     |
	+---------------------------+


cscope

How to set up the whole project. Obviously, this could be done at the same time as ctags.

	russ@taliesin:~> cd project-root
	russ@taliesin:~> cscope -R        (from project root)

Now, this actually launches cscope on a sort of text file in vi with fields into which you type function or other identifier names, press return, and get listings. You can tab between input sections and arrow-key between fields.

See http://docs.sun.com/source/819-0494/cscope.html for a tutorial.


Some interesting stuff to use in scripts...

Find out the name of the OS on the host (Linux, SunOS, HP-UX, AIX, etc.):

	russ@taliesin:~> uname -a | awk '{ print $1 }'

Hostname...

	russ@taliesin:~> uname -a | awk '{ print $2 }'

The following files exist on some Linux distros...

	/etc/SuSE-release
	/etc/redhat-release


Breaking into a hung machine...

Try pressing...

	Control Alt F1            or
	Control Alt Backspace


And, if your network’s gone...

It’s because someone is screwing around and what’s in /etc/resolv.conf no longer holds.

First, attempt to see if your adapters are configured:

	russ@taliesin:~> ifconfig
	eth0      Link encap:Ethernet  HWaddr 00:10:C6:A2:0A:68
	          inet addr:10.5.35.165  Bcast:10.5.47.255  Mask:255.255.240.0
	          inet6 addr: 3ffe:302:11:2:210:c6ff:fea2:a68/64 Scope:Global
	          inet6 addr: fe80::210:c6ff:fea2:a68/64 Scope:Link
	          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
	          RX packets:21040 errors:0 dropped:0 overruns:0 frame:0
	          TX packets:4662 errors:0 dropped:0 overruns:0 carrier:0
	          collisions:0 txqueuelen:1000
	          RX bytes:2192482 (2.0 Mb)  TX bytes:406559 (397.0 Kb)
	          Interrupt:169

	lo        Link encap:Local Loopback
	          inet addr:127.0.0.1  Mask:255.0.0.0
	          inet6 addr: ::1/128 Scope:Host
	          UP LOOPBACK RUNNING  MTU:16436  Metric:1
	          RX packets:195 errors:0 dropped:0 overruns:0 frame:0
	          TX packets:195 errors:0 dropped:0 overruns:0 carrier:0
	          collisions:0 txqueuelen:0
	          RX bytes:14728 (14.3 Kb)  TX bytes:14728 (14.3 Kb)

	vmnet1    Link encap:Ethernet  HWaddr 00:50:56:C0:00:01
	          inet addr:192.168.143.1  Bcast:192.168.143.255  Mask:255.255.255.0
	          inet6 addr: fe80::250:56ff:fec0:1/64 Scope:Link
	          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
	          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
	          TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
	          collisions:0 txqueuelen:1000
	          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

	vmnet8    Link encap:Ethernet  HWaddr 00:50:56:C0:00:08
	          inet addr:172.16.104.1  Bcast:172.16.104.255  Mask:255.255.255.0
	          inet6 addr: fe80::250:56ff:fec0:8/64 Scope:Link
	          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
	          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
	          TX packets:21 errors:0 dropped:0 overruns:0 carrier:0
	          collisions:0 txqueuelen:1000
	          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

That succeeding, ping something like Google:

	russ@taliesin:~> ping Google

If that doesn’t work, then see if the cable is connected (good hardware connections) by pinging our gateway:

	russ@taliesin:~> ping 10.5.32.1

It’s also possible to view the route taken using (option -n means show the routing table, but don’ try to resolve anything)...

	russ@taliesin:~> route -n

Depending on what is learned from these commans, it’s looking like a bad /etc/resolv.conf. See discussion of /etc/resolv.conf and my resolv.sh script for what this looks like.


Mounting an ISO on loopback...

Create a new subdirectory to be used as a mount point first.

	russ@taliesin:~> mkdir /home/russ/vasapi
	russ@taliesin:~> sudo mount -o loop VAS-site-3.0.0-25.iso /home/russ/vasapi

To undo this...

	russ@taliesin:~> sudo umount VAS-site-3.0.0-25.iso


Mounting a built directory as if an ISO...

Renae uses this method to test builds as if ISOs.

	russ@taliesin:~> mkdir /mnt/jerry
	russ@taliesin:~> sudo mount -o ro slcflsl01.prod.quest.corp:/data/vas /mnt/jerry

To undo this...

	russ@taliesin:~> sudo umount /mnt/jerry

Then just switch to the directory and run...

	russ@taliesin:/mnt/jerry/dev-builds/junk> cd /mnt/jerry/dev-builds/junk
	russ@taliesin:/mnt/jerry/dev-builds/junk> ./install.sh -d 1 -n -a (etc.)

Mounting a CD-ROM...

	russ@taliesin:~> mount [-t type] /dev/hde /cdrom
Or, if /etc/fstab contains...
	/dev/cdrom/cd iso9660 ro,user,noauto, unhide
then do one of these (must be root)...
	russ@taliesin:~> mount /dev/cdrom
	russ@taliesin:~> mount /cd


Printer...

Local printer, no auto-detect of Plug’n’Play, new port, TCP/IP at address 10.5.34.1.


Host information...

To get interesting information on your host hardware (like opening the System details in the Windows control panel), the following is helpful:

	russ@taliesin:~> uname -a
	russ@taliesin:~> cat /proc/cpuinfo
	russ@taliesin:~> ps ax
	russ@taliesin:~> top                  # (gets a screenful of the most active processes)


POSIX Access Control Lists on Linux

Paper by engineer at SuSE discussing file system access control lists (ACLs) as implemented in several UNIX-like operating systems, see http://www.suse.de/~agruen/acl/linux-acls/online/


2 NICs versus “multihomed”...

Multihomed means that you have one network interface card (NIC), but two different IP addresses assigned to it. The other option is to have two NICs, each with its own address.


man sections exposed...
 0 Not used.
 1 Commands that all users can enter.
 1mCommands related to system maintenance and operation.
 2 System calls, or program interfaces to the operating system kernel.
 3 Programming interfaces found in various libraries.
 4 Include files, program output files, and some system files.
 5 Miscellaneous topics, such as text-processing macro packages.
 6 Games.
 7 Device special files, related driver functions, and networking support.
 8 Commands related to system maintenance and operation.
 9 Writing device drivers.

curses links...

Links to curses information...


How I hooked up my Hyundai monitors...

http://www.windofkeltia.com/opensoftware/hyundai.html

...and other fun like updating my NVIDIA driver so I could hook up my new 20" Samsung monitors: http://www.windofkeltia.com/opensoftware/nvidia-update.html


Visual Slickedit

I tried VSE a little bit in an attempt to over-come the paucity of tagging from Vim, but in frustration with its broken Vi emulation, discovered Exuberant ctags and found I didn’t need VSE. Nevertheless, here are random notes on using it...

	.slickedit/vunxdefs.e

Steps to remap:

Can also remap ^C, ^V, ^X, etc. as copy-region, paste and cut-region.

The ctag keys in VSe are ^., ^, and ^/ (list reference).


Memory totals on Linux

Following are several methods of finding the total memory installed on a Linux host. One, lshw, is something I’ve not seen work nor taken the time to make work, but I put it in here for completeness. top is an executable that takes over your console window until you press 'q' for quit. These examples are taken from my own host which has 1 gigabyte.

	russ@taliesin:~> free -m
	             total       used       free     shared    buffers     cached
	Mem:          1010        901        108          0         45        157
	-/+ buffers/cache:        698        311
	Swap:         1027        649        378

	russ@taliesin:~> cat /proc/meminfo
	MemTotal:      1034944 kB
	MemFree:        103644 kB
	Buffers:         46312 kB
	Cached:         166836 kB
	SwapCached:     121404 kB
	Active:         831056 kB
	Inactive:        47484 kB
	HighTotal:      129984 kB
	HighFree:          248 kB
	LowTotal:       904960 kB
	LowFree:        103396 kB
	SwapTotal:     1052216 kB
	SwapFree:       388576 kB
	Dirty:             836 kB
	Writeback:           0 kB
	AnonPages:      626988 kB
	Mapped:          42512 kB
	Slab:            35000 kB
	PageTables:       3760 kB
	NFS_Unstable:        0 kB
	Bounce:              0 kB
	CommitLimit:   1569688 kB
	Committed_AS:  1798404 kB
	VmallocTotal:   114680 kB
	VmallocUsed:     54132 kB
	VmallocChunk:    55284 kB
	HugePages_Total:     0
	HugePages_Free:      0
	HugePages_Rsvd:      0
	Hugepagesize:     4096 kB

	russ@taliesin:~/HEAD/VAS/src/libs/vaslicense> top

	top - 07:09:07 up 100 days, 13:36,  5 users,  load average: 0.00, 0.02, 0.00
	Tasks: 121 total,   1 running, 118 sleeping,   0 stopped,   2 zombie
	Cpu(s):  0.2%us,  0.2%sy,  0.0%ni, 98.0%id,  0.8%wa,  0.3%hi,  0.5%si,  0.0%st
	Mem:   1034944k total,   932256k used,   102688k free,    46316k buffers
	Swap:  1052216k total,   663624k used,   388592k free,   166948k cached

	  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
	 3685 root      15   0  551m 274m 6792 S    0 27.2 236:31.38 X
	    1 root      15   0   744   72   44 S    0  0.0   0:04.49 init
	    2 root      RT   0     0    0    0 S    0  0.0   0:00.00 migration/0
	    3 root      34  19     0    0    0 S    0  0.0   0:00.18 ksoftirqd/0
	    4 root      RT   0     0    0    0 S    0  0.0   0:00.02 migration/1
	    5 root      34  19     0    0    0 S    0  0.0   0:00.57 ksoftirqd/1
	    6 root      10  -5     0    0    0 S    0  0.0   0:15.08 events/0
	    7 root      10  -5     0    0    0 S    0  0.0   0:00.00 events/1
	    8 root      11  -5     0    0    0 S    0  0.0   0:00.00 khelper
	    9 root      11  -5     0    0    0 S    0  0.0   0:00.00 kthread
	   13 root      10  -5     0    0    0 S    0  0.0   0:02.45 kblockd/0
	   14 root      14  -5     0    0    0 S    0  0.0   0:00.33 kblockd/1
	   15 root      10  -5     0    0    0 S    0  0.0   0:00.37 kacpid
	   16 root      16  -5     0    0    0 S    0  0.0   0:00.00 kacpi_notify
	  110 root      16  -5     0    0    0 S    0  0.0   0:00.00 cqueue/0
	  111 root      16  -5     0    0    0 S    0  0.0   0:00.00 cqueue/1
	  112 root      10  -5     0    0    0 S    0  0.0   0:00.01 kseriod
	  158 root      10  -5     0    0    0 S    0  0.0   3:35.98 kswapd0
	  159 root      19  -5     0    0    0 S    0  0.0   0:00.00 aio/0
	  160 root      18  -5     0    0    0 S    0  0.0   0:00.00 aio/1
	  406 root      12  -5     0    0    0 S    0  0.0   0:00.00 kpsmoused
	  774 root      10  -5     0    0    0 S    0  0.0   0:00.45 ata/0
	  775 root      10  -5     0    0    0 S    0  0.0   0:00.37 ata/1
	  776 root      16  -5     0    0    0 S    0  0.0   0:00.00 ata_aux
	  788 root      13  -5     0    0    0 S    0  0.0   0:00.01 scsi_eh_0
	  789 root      10  -5     0    0    0 S    0  0.0   0:00.02 scsi_eh_1
	  872 root      10  -5     0    0    0 S    0  0.0   0:07.68 reiserfs/0
	  873 root      10  -5     0    0    0 S    0  0.0   0:06.80 reiserfs/1
	  906 root      15   0 10024  292  288 S    0  0.0   0:00.69 blogd
	  921 root      12  -4  1796  252  248 S    0  0.0   0:00.27 udevd
	 1656 root      10  -5     0    0    0 S    0  0.0   0:00.03 khubd
	 2511 root      15   0  1668  316  312 S    0  0.0   0:00.00 resmgrd
	 2557 root      15   0  2036  616  484 S    0  0.1   1:07.70 syslog-ng
	 2564 root      15   0  1724  460  280 S    0  0.0   0:49.12 klogd
	 2571 root      15   0  1584  328  324 S    0  0.0   0:00.00 acpid
	 2573 messageb  15   0 15484 2316  548 S    0  0.2   5:45.20 dbus-daemon
	 2636 haldaemo  15   0  5668 1496 1112 S    0  0.1   3:44.58 hald
	 2637 root      17   0  2952  616  612 S    0  0.1   0:00.01 hald-runner
	 2638 root      15   0  3180 1116 1008 S    0  0.1   0:02.56 polkitd
	 3061 mdnsd     15   0  1888  564  476 S    0  0.1   0:02.68 mdnsd
	 3106 nobody    15   0  1632  308  248 S    0  0.0   0:00.02 portmap
	 3232 root      16  -3  9948  380  364 S    0  0.0   0:00.22 auditd


ssh keys on Unix

How to set up a key on a host so that you can get into it via ssh without a password?

	russ@taliesin:~/.ssh> ssh-keygen -b 1024 -t rsa
	Generating public/private rsa key pair.
	Enter file in which to save the key (/home/russ/.ssh/id_rsa):
	Enter passphrase (empty for no passphrase):
	Enter same passphrase again:
	Your identification has been saved in /home/russ/.ssh/id_rsa.
	Your public key has been saved in /home/russ/.ssh/id_rsa.pub.
	The key fingerprint is:
	61:25:8a:15:86:ff:cb:3d:ec:7e:5c:16:2b:6f:73:b3 russ@taliesin
	russ@taliesin:~/.ssh> ll total 48
	-rw-r--r-- 1 russ users   223 2006-06-27 13:10 authorized_keys
	-rw-r--r-- 1 russ users   116 2007-03-05 11:11 config
	-rw------- 1 russ users   887 2008-07-29 14:58 id_rsa
	-rw-r--r-- 1 russ users   223 2008-07-29 14:58 id_rsa.pub
	-rw-r--r-- 1 russ users 31323 2008-07-28 08:48 known_hosts
	russ@taliesin:~/.ssh> scp id_rsa.pub root@vasx8664.vintela.com:/home/rbateman/.ssh
	root@vasx8664.vintela.com's password:
	id_rsa.pub                                    100%  223     0.2KB/s   00:00

On the remote host...

	russ@taliesin:~/.ssh> ssh rbateman@vasx8664.vintela.com
	rbateman@vasx8664.vintela.com's password:
	Last login: Thu Jul 24 10:15:35 2008 from vasx8664.vintela.com
	[rbateman@slc205613 root]# cd /home/rbateman/.ssh
	[rbateman@slc205613 .ssh]# ll
	total 28
	-rw-r--r--    1 rbateman slc           488 Jul 29 14:39 authorized_keys
	-rwxr-xr-x    1 rbateman slc          2372 Oct  9  2007 equip_all_plats.sh
	-rw-r--r--    1 rbateman slc           223 Jul 29 14:53 id_rsa.pub
	-rw-r--r--    1 rbateman slc          8865 Oct  9  2007 known_hosts
	[rbateman@slc205613 .ssh]# cat id_rsa.pub >> authorized_keys
	[rbateman@slc205613 rbateman]$
	^D
	Connection to vasx8664.vintela.com closed.

Back on the local host, we can now ssh to the remote host without a password:

	russ@taliesin:~/.ssh> ssh rbateman@vasx8664.vintela.com
	Last login: Tue Jul 29 14:54:05 2008 from taliesin.vintela.com


Using locate...

locate is a great tool—much faster and easier to use than find. To get it, use YaST->Software->Software Management, type in “locate” as the filter/search string, and click findutils-locate if that package has not been installed already. This is the GNU Findutils Subpackage. Install it if need be.

Once installed, it’s probably on your PATH, so first update its index (database). It searches all your filesystem indexing the files thereon. Later, you’ll want to chron this action to run late at night while you’re asleep.

Then, use man locate to learn how to use it, however, here are a couple of examples:

	russ@taliesin:~/GWAVA> which updatedb
	/usr/bin/updatedb
	russ@taliesin:~> updatedb

	russ@taliesin:~/GWAVA> locate vicheat.gif
	/home/russ/GWAVA/vicheat.gif
	/home/russ/Quest/documents/vintela/vicheat.gif
	/home/russ/Quest/notes/vicheat.gif

	russ@taliesin:~/GWAVA> locate /web/WEB-INF/cfg | grep ASConfig.cfg
	/home/russ/dev/svn/retain/RetainServer/web/WEB-INF/cfg/ASConfig.cfg

	russ@taliesin:~/GWAVA> locate /web/WEB-INF/cfg/.svn/tmp
	/home/russ/dev/svn/retain/RetainServer/web/WEB-INF/cfg/.svn/tmp
	/home/russ/dev/svn/retain/RetainServer/web/WEB-INF/cfg/.svn/tmp/prop-base
	/home/russ/dev/svn/retain/RetainServer/web/WEB-INF/cfg/.svn/tmp/props
	/home/russ/dev/svn/retain/RetainServer/web/WEB-INF/cfg/.svn/tmp/text-base
	/home/russ/dev/svn/retain/RetainWorker/web/WEB-INF/cfg/.svn/tmp
	/home/russ/dev/svn/retain/RetainWorker/web/WEB-INF/cfg/.svn/tmp/prop-base
	/home/russ/dev/svn/retain/RetainWorker/web/WEB-INF/cfg/.svn/tmp/props
	/home/russ/dev/svn/retain/RetainWorker/web/WEB-INF/cfg/.svn/tmp/text-base

VNC...

eth0 must be assigned to a zone in order for VNC to work. Go to Firewall Configurations->Interfaces.


More Yast...

To examine what repositories are used by Yast, you can launch Yast and choose Software->Software Repositories or you can do this:

	taliesin:/ # zypper sl
# | Enabled | Refresh | Type   | Alias                                                             | Name
--+---------+---------+--------+-------------------------------------------------------------------+-----------------------------
1 | Yes     | Yes     | yast2  | http://download.opensuse.org/repositories/openSUSE:10.3/standard/ | Main Repository (OSS)
2 | Yes     | No      | yast2  | openSUSE-10.3-OSS-Gnome 10.3                                      | openSUSE-10.3-OSS-Gnome 10.3
3 | Yes     | Yes     | yast2  | http://download.opensuse.org/distribution/10.3/repo/debug/        | Main Repository (DEBUG)
4 | Yes     | Yes     | rpm-md | Mozilla                                                           | Mozilla
5 | Yes     | Yes     | rpm-md | NVIDIA Repository                                                 | NVIDIA Repository
6 | Yes     | Yes     | rpm-md | openSUSE-10.3-Updates                                             | openSUSE-10.3-Updates

This is much faster than the Yast GUI.


netstat

This command prints out network connections, routing tables and other network-related information. In particuler, below we are looking to make certain port 5900 is assigned to TCP. In fact, it's going to be used by Tomcat which, for some reason, appears as vino-server. We don't see other programs identified because Tomcat belongs to us, but not the other processes.

	russ@taliesin:~> netstat -nltp
	(Not all processes could be identified, non-owned process info
	 will not be shown, you would have to be root to see it all.)
	Active Internet connections (only servers)
	Proto Recv-Q Send-Q Local Address     Foreign Address   State     PID/Program name
	tcp        0      0 127.0.0.1:48005   0.0.0.0:*         LISTEN    -
	tcp        0      0 0.0.0.0:904       0.0.0.0:*         LISTEN    -
	tcp        0      0 0.0.0.0:48009     0.0.0.0:*         LISTEN    -
	tcp       0     0 0.0.0.0:5900   0.0.0.0:*       LISTEN   4574/vino-server
	tcp        0      0 0.0.0.0:111       0.0.0.0:*         LISTEN    -
	tcp        0      0 0.0.0.0:48080     0.0.0.0:*         LISTEN    -
	tcp        0      0 0.0.0.0:22        0.0.0.0:*         LISTEN    -
	tcp        0      0 127.0.0.1:25      0.0.0.0:*         LISTEN    -

As root, we see:

	taliesin:/home/russ # netstat -nltp
	Active Internet connections (only servers)
	Proto Recv-Q Send-Q Local Address     Foreign Address   State     PID/Program name
	tcp        0      0 127.0.0.1:48005   0.0.0.0:*         LISTEN    6915/java
	tcp        0      0 0.0.0.0:904       0.0.0.0:*         LISTEN    3851/xinetd
	tcp        0      0 0.0.0.0:48009     0.0.0.0:*         LISTEN    6915/java
	tcp       0     0 0.0.0.0:5900   0.0.0.0:*       LISTEN   4574/vino-server
	tcp        0      0 0.0.0.0:111       0.0.0.0:*         LISTEN    3370/portmap
	tcp        0      0 0.0.0.0:48080     0.0.0.0:*         LISTEN    6915/java
	tcp        0      0 0.0.0.0:22        0.0.0.0:*         LISTEN    3541/sshd
	tcp        0      0 127.0.0.1:25      0.0.0.0:*         LISTEN    3976/master

Elsewhere, on host windofkeltia, we see yet different names for Tomcat (jsvc.exec):

	windofkeltia:/home/rbateman # netstat -nltp
	Active Internet connections (only servers)
	Proto Recv-Q Send-Q Local Address     Foreign Address   State     PID/Program name
	tcp        0      0 0.0.0.0:111       0.0.0.0:*         LISTEN    2826/portmap
	tcp        0      0 127.0.0.1:2544    0.0.0.0:*         LISTEN    3184/zmd
	tcp        0      0 127.0.0.1:631     0.0.0.0:*         LISTEN    2898/cupsd
	tcp        0      0 127.0.0.1:25      0.0.0.0:*         LISTEN    3352/master
	tcp        0      0 :::80             :::*              LISTEN    6337/httpd2-prefork
	tcp        0      0 :::22             :::*              LISTEN    3394/sshd
	tcp        0      0 ::1:631           :::*              LISTEN    2898/cupsd
	tcp        0      0 ::1:25            :::*              LISTEN    3352/master
	windofkeltia:/home/rbateman # /etc/init.d/tomcat start
	Starting Apache Tomcat Server...                                      done
	windofkeltia:/home/rbateman # netstat -nltp
	Active Internet connections (only servers)
	Proto Recv-Q Send-Q Local Address     Foreign Address   State     PID/Program name
	tcp        0      0 0.0.0.0:111       0.0.0.0:*         LISTEN    2826/portmap
	tcp        0      0 127.0.0.1:2544    0.0.0.0:*         LISTEN    3184/zmd
	tcp        0      0 127.0.0.1:631     0.0.0.0:*         LISTEN    2898/cupsd
	tcp        0      0 127.0.0.1:25      0.0.0.0:*         LISTEN    3352/master
	tcp       0     0 :::8009        :::*            LISTEN   601/jsvc.exec
	tcp       0     0 :::8080        :::*            LISTEN   601/jsvc.exec
	tcp        0      0 :::80             :::*              LISTEN    6337/httpd2-prefork
	tcp        0      0 :::22             :::*              LISTEN    3394/sshd
	tcp        0      0 ::1:631           :::*              LISTEN    2898/cupsd
	tcp        0      0 ::1:25            :::*              LISTEN    3352/master

.bin files on Linux

Files that you download and end in .bin are simply self-extracting archives. To extract, change the permissions to add executable and invoke.

o
	russ@taliesin:~/download> chmod a+x jdk-6u12-linux-i586.bin
	russ@taliesin:~/download> ./jdk-6u12-linux-i586.bin
	russ@taliesin:~/download> ll
total 78324
drwxr-xr-x 10 russ users     4096 2009-02-11 15:11 jdk1.6.0_12
-rwxr-xr-x  1 russ users 80105323 2009-02-11 15:03 jdk-6u12-linux-i586.bin

GNU and gcc downloads

Obtain any version of GNU tools from ftp://mirrors.kernel.org/gnu or, likewise, gcc from ftp://mirrors.kernel.org/gnu/gcc.


Anonymous ftp

Here's how to conduct an anonymous ftp session to upload a couple of files. What you type is in bold.

	russ@taliesin:~/build/1.7> ftp
	ftp> open ftp.funtime.com
	Connected to provo.funtime.com.
	220 FTP Server ready.
	Name (ftp.funtime.com:russ): anonymous
	331 Anonymous login ok, send your complete email address as your password
	Password: russ@windofkeltia.com
	230 User anonymous logged in.
	Remote system type is UNIX.
	Using binary mode to transfer files.
	ftp> cd incoming
	250 CWD command successful
	ftp> binary
	200 Type set to I
	ftp> put rs-2009-06-05.zip
	local: rs-2009-06-05.zip remote: rs-2009-06-05.zip
	229 Entering Extended Passive Mode (|||43813|)
	150 Opening BINARY mode data connection for rs-2009-06-05.zip
	100% |*************************************| 35224 KB    1.00 MB/s    00:00 ETA
	226 Transfer complete
	36069479 bytes sent in 00:34 (1.00 MB/s)
	ftp> put rw-2009-06-05.zip
	local: rw-2009-06-05.zip remote: rw-2009-06-05.zip
	229 Entering Extended Passive Mode (|||19475|)
	150 Opening BINARY mode data connection for rw-2009-06-05.zip
	100% |*************************************|  8836 KB    1.02 MB/s    00:00 ETA
	226 Transfer complete
	9048118 bytes sent in 00:08 (1.02 MB/s)
	ftp> quit
	221 Goodbye.
	russ@taliesin:~/build/1.7>

Installing Flash play for Firefox

Only on Ubuntu and openSuSE will Firefox make good on installing the missing Flash plug-in. On other Linuces, you have to:

  1. Find Firefox installation. Usually /usr/bin/firefox is a symbolic link to the installation, often found at /usr/lib/firefox.
  2. Create a new subdirectory, plugins.
  3. Download the player for Linux as a tarball (file ending in .tar.gz) from Adobe. The easiest thing to do is launch Firefox, browse to a page requiring the plug-in, usually http://www.windofkeltia.com/ is a sure one, and attempt to get the issue resolved by Firefox, which will fail (that's why you're reading this). Navgiate through the procedure to the "manual install" and then you'll be able to pick the right download (the tarball).
  4. Place the tarball in the plug-in directory you created under Firefox and blow it open.
    	# gunzip -d install_flash_player_10_linux.tar.gz
    	# tar -xvf install_flash_player_10_linux.tar
    	# rm install_flash_player_10_linux.tar
    			

    This will leave you with libflashplayer.so in the plug-in subdirectory.

  5. Bounce Firefox and you're there.

How to move Lucid's window buttons back to the right

See how here.