Keyboard shortcuts for your Mac at boot time

Keep one of these keys pressed at system start.

Command key
Control key
Option key
Shift Key
Caps Lock
fnFunction Key
CBoots from a CD/DVD with a system image
DBoots from the first HD partition
NBoots from the network (netboot)
REnforces a screen reset
TBoots in firewire target mode
Boots in safe mode. Disables login items and less important kernel files
⌘VBoots in verbose mode
⌘SBoots in single-user mode. Goes directly into command-line
 Displays possible startup disks

… and much more: http://support.apple.com/kb/HT1343

Start a TFTP server on your Mac

Activate the tftp server on your Mac:

To change the properties, edit the file

/System/Library/LaunchDaemons/tftp.plist

The default directory is /private/tftpboot.

Make this directory accessible for everybody.

chmod 777 /private/tftpboot

and start it with

sudo launchctl load -F /System/Library/LaunchDaemons/tftp.plist

If you want to stop the daemon, do

sudo launchctl unload /System/Library/LaunchDaemons/tftp.plist

Backup a system to a remote location using ‘netcat’ and ‘tar’

I use to say “backup is only for wimps”. But to be honest, I do backups. And I even store the backup media in a save place.

To get the data onto a backup device and put that one to a save place, sometimes you have to write the backup over the network.

netcat or nc, the swiss army knife of networking is a big help for that.

On the remote system, where you want to write the backup start netcat:

nc -l -p 12345 > /var/backup/name-of -the-backup-2010-08-18.tgz
  • -l means listen
  • -p <number> is the port, where nc listens.

On the system you want to backup  you can exclude some directories, like /proc and /sys from being backed up. So run:

echo "./proc
./sys
./tmp" > /tmp/X

Now it is time to start the backup:

cd /
tar -X /tmp/X -czpf - . | nc 11.12.13.14 12345

So you cd into the root directory, exclude the files listed in /tmp/X, write the backup to STDOUT  and backup everything under the current directory. The backup is done relative.

Of course, you could use a backup command like tar -czpf – /,  but then the backup is done absolute. You realize the advantage of doing relative backups, when you want to restore the backup into a directory. With an absolute backup everything is written back to the original location.

Upload Firmware from a Mac using Xmodem

If you have to upload firmware to a router or a switch with xmodem, get the package lrzsz-0.12.20.tar.gz. Configure it with

tar xvzf lrzsz-0.12.20.tar.gz
cd lrzsz-0.12.20
./configure --disable-nls && sudo make install

Then start a console session with screen

screen /dev/tty.Keyserial1 9600

then, when you are asked from the program up upload the firmware using xmodem, do:

Press ctrl-a
:exec !! lsx -b -X /path/srw2016-24-10086.ros

the upload will start.