Dear readers: Sigh, third try's a charm? I promise this one has no formatting errors ... but then again, that's what I thought the last time, too.
Dear readers: This hint originally appeared yesterday. However, somewhere between Smultron, Geeklog, and publication, I badly munged the contents. I managed to repeat the intro while skipping all the details I intended to explain. My apologies for this; I have nobody to blame but myself for not concentrating on the task at hand. The corrected hint appears below. Given how badly I messed up the original, I chose to re-run this one again today, just so folks would have a chance to read the corrected version.
So as to not confuse people, I also removed a couple of comments that basically just talked about the formatting issues with the original hint. I've left the remainder of the comments, however, and actually chose to refer to sweth's explanation directly in the hint, as it's much clearer than mine ever was! I also adjusted the command per his comments on "w" vs. "S," and re-titled the hint to make it a bit less confusing.
Finally, for those who commented that this hint doesn't belong here, I'd just like to point out that we have 1,226 other Unix tips in the system, and I have no intention of not publishing such tidbits. If you have no interest in seeing Unix tips, registered users can easily disable the entire category in their preferences. But OS X is built on Unix, and to claim that a Unix tip isn't relevant to OS X just isn't accurate.
Yesterday, I was doing some global editing on a relatively large text file, and accidentally made one change too many, saved changes, and quit the editor before I noticed the problem. The result? My file was now littered with sentences that ran together at the period:
...my bearers would hurl me.As they bore me along...
...glanced at the thermometer."Gad!" he cried...
...might make reparation.I made up my mind that...
For the curious, those lines are from Edgar Rice Burroughs' book At the Earth's Core, the text of which I'm using in a comment spam blocker I'm writing for my blog site. I was editing the text to remove some of the spurious punctuation that was causing my code to misinterpret the position of word breaks, and I got overly aggressive removing some spaces. Read on to see how I resolved it with some help from a friend, and the Unix underpinnings of OS X.
Last week, we ran this hint about using MacFUSE to install sshfs, which lets you mount ssh-connected servers like regular folders in the Finder. I tried it last weekend, and while I was generally thrilled with it (it's amazingly handy being able to work in remote folders as if they're local), I had some issues. In particular, it seems not to interact well with Path Finder (sshfs connections don't show as mounted volumes, for instance, unless they're in /Volumes, but they will do so in the Finder). I also had two kernel panics when I tried to unmount a mounted file system, so I decided to remove MacFUSE for now.
Unfortunately, there's no uninstaller included with the disk image distribution. After some rooting around on the MacFUSE site, I found these removal instructions on the Issues tab. I'm posting this hint mainly to say that I indeed tried the removal script posted there, and it seems to have worked well. I also checked the programs listed in the removal script against my MacBook Pro (which hasn't ever had MacFUSE installed), and found no overalp (so nothing listed there is used by anything else). The only extra step I took was to also remove the MacFUSE receipts from /Library -> Receipts.
There's a lot of promise in MacFUSE, but I think I'll wait a couple generations before trying it again!
I have always found that Mac OS X lacks an elegant yet free downloading tool that supports segmented downloading until I met ">aria2, which is a linux-based command-line downloading tool. From their website:
aria2 is a download utility with resuming and segmented downloading. Supported protocols are HTTP/HTTPS/FTP/BitTorrent. It also supports Metalink version 3.0.
It is very stable and fast (at least no slower than Speed Download and iGetter on my computer. However, the latest 0.9 version of aria2 does not compile on Mac OS X. After some work, I figured out how to make it compile -- read on for the how-to.
I have been searching for some sort of automated backup while I wait patiently for 10.5's Time Machine. While searching, I found this article on TUAW covering one method of automating the process.
I have re-written the backup scripts from that article to make them a little friendlier. Current features include:
Supports the backing up of multiple source directories
Uses rsync to cut down on un-necessary file transfers
Designed to allow for a minimum time between backups (default 24 hours) to prevent un-necessary system interruption.
I am planning on implementing several new features when time permits, including different backup profiles for different devices (eg: full backup to this drive, but only backup my documents and keychain when my iPod is plugged in...), and network rsync support...
Full code and instructions can be found here, and comments and suggestions welcome...
[robg adds: I haven't tested this one, but since backup is a personal hot topic of mine (not enough people have working (ideally multiple) backups), I thought it worth sharing.]
The hint presents a way to generate a list of all of the Unix commands in your execution PATH (see this Unix FAQ for an explanation of the execution PATH variable) with a one-line synopsis for each program (assuming this one-line description is available). This is accomplished via a rather complicated pipeline of commands:
Here are the first several lines of output from the above command when run on my Mac:
SystemStarter - Start, stop, and restart system services
Xmark - summarize x11perf results
Xnest - a nested X server
Xquartz - X window system server for Quartz operating system
Xvfb - virtual framebuffer X server for X Version 11
a2p - Awk to Perl translator
If you want the output of the above command to be saved into a file instead of appearing in the Terminal window, add a greater-than sign and then the name of the file you want to create at the end of the command.
If you use the MacPorts and Fink package managers, you might find it useful to be able to update both package managers with one simple command. I wrote the following simple script which does just that:
#the script updates MacPorts and Fink packages;
if [ "$(whoami)" != 'root' ]; then
echo "You have no permission to run $0 as non-root user."
port -d sync
port upgrade installed
fink -q -y selfupdate
fink -q -y update-all
Just create a file containing that code and save it, say, to your home folder. Assuming that the file's been saved as ~you/updf (where you is your short username), just cd to that directory and make the code executable:
chmod u+x upfg
If it's not already set, you might also add the line PATH=$PATH:~you to your profile. Then simply type sudo upfd, wait a little bit, and you're done. Hopefully, that is, if there are no compilation errors, but that's another story!
I was trying to figure out a way to be able to access my my Safari bookmarks from anywhere, without having to dig through the plist folder over ssh (especially on a slow connection). So, I wrote a shell script to do it; it does require plcat, which is part of the free PLtools package.
[robg adds: Set the script to executable (chmod a+x script_name), and edit the script to replace **YOUR USERNAME** with, well, your user name. I tested the script, and it works -- it creates an index.html file in whichever directory you run it in. You can then edit or view the index.html file using any text editor, such as vi.]
I always wanted to use the ffmpeg command line tool (the one ffmpegX is the GUI of) in Terminal, but I didn't find it in Fink, and I didn't want to compile it from an experimental source. Well, there is a working binary of ffmpeg bundled with ffmpegX. To get it, simply follow these steps:
Get ffmpegX from the above URL. It's a pretty useful tool, because the ffmpeg synatx isn't quite easy to handle.
Control-click on the ffmpegX application, choose Show Package Contents from the pop-up menu, and navigate into Resources.