Categories
Unix Notes

Re: moving the cursor with the mouse

in Terminal.app

Do this first – it sets a default that was missing…

defaults write com.apple.Terminal OptionClickToMoveCursor ‘YES’

then you can option-click to move the cursor in terminal windows.

Categories
Unix Notes

Help debugging sendmail problems

Here’s how to debug some of the sendmail…

?You could kill sendmail, and start it manually via

/usr/lib/sendmail -v -d0-99.99

to make it tell you what its doing with the incoming mail. This will produce tons of output….

Categories
Unix Notes

awk is your friend

I thought I was going to have to use the split function, but I found -F instead…

grep APPLETALK_HOSTNAME /etc/hostconfig | awk -F= ‘{print $2}’

the -F option for awk sets the field separator. This lets you refer to the parts of the string by their position…

Categories
Unix Notes

groff – man pages

from MacOSXHints…

There was a previous hint that mentioned using ‘col -b’ to convert a manpage to plain text. Unfortunately, plain text doesn’t give nice fontification (underline, italics, etc).

You can convert manpages to much nicer looking html (or postscript) for pretty printing or perusing in a web browser by using groff. In fact, the man command uses the ASCII driver for groff (or maybe troff) to get the output that it displays. Try the following examples:
% groff -Tascii -man /usr/share/man/man1/ls.1 > ls.txt
% groff -Thtml -man /usr/share/man/man1/ls.1 > ls.html
% groff -Tps -man /usr/share/man/man1/ls.1 > ls.ps

The ‘-man’ option is required, as it tells groff to use the ‘an’ set of macros. Look at man groff for more output types (devices) and options.

[Editor’s note: Another previous hint explained how to download and install the newest version of groff if you want to be current. The HTML output option given in this hint is quite nice; use it on the “tcsh” man pages to make them easier to browse.]

Categories
Unix Notes

Finding changed files

If you want to see what an application does to the file system try this


touch /tmp/marker

{change a preference via the GUI}

sudo find / -newer /tmp/marker -ls

Categories
Unix Notes

Kill an application from AppleScript


on forceQuit(appName)

set pid to word 1 of (do shell script ("ps -xo,pid,command | grep "" & appName & "" | head -n 1"))

do shell script ("kill -9 " & pid)

end forceQuit

forceQuit("Clock")

From another user… i suggest changing that to “ps -xwwo,pid,command …” to avoid a problem where commands with very long path names are truncated, causing the grep to fail.

Categories
Unix Notes

What is wrong with this find command

What is wrong with this find command – it is subtle…

find . -type f ! -name "*.mp3" -exec mv "{}" "{}.mp3" ; 

Think about what files might be affected

Categories
Unix Notes

Empty trashes from root user

How to empty the trash with administrator privileges… handy…

rm -rf /.Trashes/* ~/.Trashes/* ~/.Trash/* # /Volumes/*/.Trashes/*

Categories
Unix Notes

Option-click to position cursor in Terminal.app

macosxhints – Option click to position terminal cursor

Well, in the terminal preferences, under the last option “Emulation”, you can turn on “option click to position cursor.” Which allows one to ‘option click’ in any command and have the cursor positioned under the mouse pointer. Particularly useful in pico, so you don’t have to scroll through the whole config file.

Categories
Unix Notes

Email Servers on Mac OS X

Email Servers and Mac OS X