Unix Notes

You are currently browsing the archive for the Unix Notes category.

The bash shell used in the Terminal application can be tweaked a little for better interactive experience, by saving the following lines as .intputrc in your home directory:

via Advanced readline settings for bash in Terminal – Mac OS X Hints.

The behavior of ‘bash’ is changed by more files that .bash_profile. In particular, the ‘readline’ settings are found in .inputrc – bashed my head against the wall for a while on a system that didn’t ignore case on filename completion.

inputrc

completion-ignore-case

There are several hints on this site for unmounting a partition at login, but a better way to make this happen can be used. You need to create an entry point in your filesystem table to tell the OS not to mount that specific volume, and this is relatively easy. In Mac OS X, and under Linux and others unix systems, the volume mounting configuration file is located in /etc/fstab. This file in Mac OS X Tiger is empty in Panther, its commented, but type man fstab in Terminal to read some important information.

via Prevent a given partition from mounting at boot – Mac OS X Hints.

I defined a function in bash. I forgot what it was, specifically. I wanted to see all of the functions.

declare -f - functions+body
declare -F - functions

sudo rsync –dry-run –verbose –archive “/Volumes/black-hole/Clones/” “/Volumes/Media”

Terminal Tips: Enable “path view” in Finder:

defaults write com.apple.finder _FXShowPosixPathInTitle -bool YES

(Via The Unofficial Apple Weblog.)

THIS DOESN’T WORK. Logs get confused (logging stops). Haven’t figured out a way to make it *really* work on Leopard.

Receive syslog info from router on iMac (Leopard)
Posted: Nov 28, 2007 6:51 AM in response to: YamaLuha
Solved

To enable your Leopard system to receive network syslog submissions edit /System/Library/LaunchDaemons/com.apple.syslogd.plist and uncomment the lines specified in the comments so that the end of the file looks something like this.

<key>NetworkListener</key>
<dict>
  <key>SockServiceName</key>
  <string>syslog</string>
  <key>SockType</key>
  <string>dgram</string>
</dict>

NB – the NetworkListener is part of the Socket dict entry!!!

Then execute the following commands (wait a few seconds between commands):
sudo launchctl unload /System/Library/LaunchDaemons/com.apple.syslogd.plist
sudo launchctl load /System/Library/LaunchDaemons/com.apple.syslogd.plist

That is enough to get an apple base station to dump it’s log into the system log.

Sed is the ultimate stream editor. If that sounds strange, picture a stream flowing through a pipe. Okay, you can't see a stream if it's inside a pipe. That's what I get for attempting a flowing analogy. You want literature, read James Joyce.

Anyhow, sed is a marvelous utility. Unfortunately, most people never learn its real power. The language is very simple, but the documentation is terrible. The Solaris on-line manual pages for sed are five pages long, and two of those pages describe the 34 different errors you can get. A program that spends as much space documenting the errors than it does documenting the language has a serious learning curve.

Do not fret! It is not your fault you don't understand sed. I will cover sed completely. But I will describe the features in the order that I learned them. I didn't learn everything at once. You don't need to either.

Sed – An Introduction and Tutorial.

howto/ccache – MacPorts – Trac

This HOWTO covers how to enable building with ccache. It is a compiler cache. It uses the gcc -E switch and a hash to detect when a compilation can be satisfied from cache. The effect is that packages frequently compile 5-10 times faster than they would otherwise.

We’ll see how this changes behavior – installed 2008-06-06 05:00:00

sudo ipfw add deny src-ip 123.45.67.89, 127.0.0.1/8

That should do the trick.

Well, I hosed my printing system. At least it appeared that way.

I know – let’s go backwards in time and make like it didn’t happen.

Boot from the Leopard DVD. Tell it we want to restore from a Time Machine backup.
Wait about 90 minutes for the whole thing to restore. So far, so good.

I got the printing working as desired. All the systems can see the shared printers.
That should do it, right? Wrong!

1. I have a leftover swap file on the Time Machine disk – easy to get rid of – delete it.
2. I have a *very* large backup snapshot in the Time Machine – like 55GB – like it is a complete snap of the restored system. You would think that it would know that I restored from snapshot “A” and would simply make a hard link to that…hmmm
3. mail doesn’t work. My nightly cron job that backs up the databases sends mail. I didn’t get it.

Have to fix mail – wound up trying sudo /etc/postfix/post-install create-missing which got me most of the way there. I had to restart to get the mail daemons all “happy” again.

Oh, yes.

iTunes lost window positioning, had to be re-authorized for iTunes Store songs.

Mail.app decided that it had to import all of my mail! Only real problem there was that it had lots of messages marked unread that had actually been read. Not a big deal. It got the 66,000+ messages into the right places.

« Older entries