Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Make utility Terminal windows less intrusive UNIX
This falls into a "nitpicky" category. As someone who enjoys the extreme customization ability of X11's (e.g. XFree86) ATerm program, but hates the holdbacks that go along with using X11, I am always looking for ways to make Terminal behave more like ATerm.

One of the things I like to do is to see a couple of my log files all of the time. With ATerm, I can make a 100x8 character window, remove the scroolbars, titlebar, and resize handles, turn it 60% transparent, and put it in a corner. Good stuff.

In Terminal, you can't get quite that handy, but you can get close. Read the rest of the article for some settings to make "utility" terminal windows less intrusive...
read more (136 words)   Post a comment  •  Comments (7)  
  • Currently 0.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (0 votes cast)
 
[11,391 views] Email Article To a Friend View Printable Version
Work with resource forks in the Terminal UNIX
While visiting a friend the other night, he showed me a trick in the terminal that I hadn't seen before, and I'm pretty sure hasn't been mentioned here as of yet. I'm also not sure of the usefulness of this trick, but it is interesting.

You can work with the resource fork for any file by simply adding "/rsrc" to the end of some file handling commands. For example, you could use this method to see which files within a directory contain resource forks:
% ls -al */rsrc
-rw-r--r-- 1 robg staff 0 Apr 25 2001 top.term/rsrc
-rwx---rwx 1 robg staff 0 Nov 21 22:33 travel.pdf/rsrc
You can also use this flag on "cat" and "cp" commands, allowing you to display (not very useful) or copy the resource fork of a given file.

I'm not sure how long this has been there, nor if the Developer Tools are required or not, but perhaps someone can find a good use for this modifier.
  Post a comment  •  Comments (5)  
  • Currently 0.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (0 votes cast)
 
[7,127 views] Email Article To a Friend View Printable Version
UNIX mail notification in the dock UNIX
All i wanted was a simple biff program for the dock, just a little, unobstrusive, audio/visual "new mail" signal, so that i wouldn't keep popping open my mutt window every N minutes (bad discipline). No such luck and too lazy to write something myself (and afraid of SOMEHOW managing to screw something up and lose mail). Here's what i ended up doing.

Read the rest of the article for the how-to. This hint assumes you have mutt and esound installed ... check out fink first if you don't...

[Editor's note: This tip also assumes the Dev Tools are installed and you have some knowledge of compiling UNIX software. I have not tried it myself, since I'm pretty happy with Mail.app]
read more (310 words)   Post a comment  •  Comments (1)  
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[6,911 views] Email Article To a Friend View Printable Version
Wake a sleeping Mac from the network UNIX
Most modern computers offer a feature called "Wake on LAN". This is designed to allow a network administrator to turn on a computer remotely, even when it is turned off, by sending a "magic packet". This is used, for instance, to allow backup programs to run at night.

I haven't found any trace of this documented on Apple's web site, but it seems Macs also implement this feature (at least my iMac G4 does). I use this feature to turn on my iMac from my office when I want to log on using ssh (I have a Solaris machine on my home LAN that runs 24/7).

The magic packet format is very simple: it must include anywhere in the packet 6 times hexadecimal FF, followed by 16 times the Mac's MAC address (pun intended). The easiest way to do this is to send a broadcast.

Here is a Python script that does this (if your MAC address is 01-23-45-67-89-0a:
#!/usr/bin/env python
import socket
s=socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.sendto('\xff'*6+'\x01\x23\x45\x67\x89\x0a'*16, ('192.168.1.255', 80))
[Editor's note: Sounds very cool, but I don't run Python ... any way to replicate this script in something that's installed on all OS X boxes? I know there are a lot of people that would probably be interested in such a solution, myself included!]
  Post a comment  •  Comments (36)  
  • Currently 3.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (8 votes cast)
 
[174,591 views] Email Article To a Friend View Printable Version
Edit iTools sites from the command line UNIX
For those of us who prefer to edit (or at least fine-tune) a webpage in a good old-fashioned text editor, iTools has made it pretty easy. If you have .html files in your Sites folder on iTools, you can simply open a terminal window and edit those files. They are located in
/Volumes/iToolsName/Sites/
where iToolsName is replaced with your iTools username.

Use vi or emacs or pico to edit whatever files you choose and save. The changes are instantaneous because you are editing the source right out. You can even create new files this way.
  Post a comment  •  Comments (3)  
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[2,042 views] Email Article To a Friend View Printable Version
An alias to ease unit conversions UNIX
An earlier hint and comments discussed using "units", a built-in UNIX tool for unit conversion. Here is a way to use the utility in a convenient way. Put this line in your aliases.mine file:
alias uni 'echo '\''scale=4; \!:1'\''`units \!:2 \!:3` |
awk '\''{print $1, $2, $3}'\'' | bc -l'
NOTE: Shown on two lines; put a space between the "|" and "awk" and remove the line break!

Now, you can get unit conversion by typing uni [value] [starting unit] [out unit]. For example:
% uni 200 nmile mile
230.1558800
This converted 200 nautical miles to statute miles. To find out which units are available, examine the file units.lib in /usr/share/misc/.
  Post a comment  •  Comments (5)  
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[3,645 views] Email Article To a Friend View Printable Version
Display remote uptime info UNIX
If you have multiple mac os x machines on a LAN, you can run rwhod found at /usr/sbin/rwhod; you will have to launch it with "sudo rwhod". If you run this on all machines on your LAN you can type ruptime and get the uptime of those machines:
[:/var/rwho] bryan% ruptime
www100 up 3+01:53, 1 user, load 1.12, 1.03, 1.01
www200 up 8+04:30, 1 user, load 1.99, 1.99, 1.99
[Editor's note: I could not get this to work on my machines; ruptime returns a "no hosts in /var/rwho" error message. Also, in trying to investigate why I was getting this message, I read a couple of articles that indicate that rwhod can flood a network with informational messages. These articles recommended disabling rwhod to improve network performance. Any thoughts on why I couldn't make this work, and/or on rwhod in general?]
  Post a comment  •  Comments (6)  
  • Currently 3.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (2 votes cast)
 
[4,320 views] Email Article To a Friend View Printable Version
More tcsh history command improvements UNIX
I've always hated the default command line completion settings in tcsh; they're too restrictive for me. I've been using JPSoftware's 4DOS/4NT command line processor on my Wintel PC for years and I love how they handle command completion. They have the TAB key cycle through all possible choices when there's more than one match, and they have the command history (up and down arrow keys) operate similarly. Also, if you simply type the name of a directory as the only argument on the command line, they treat it as the argument to the "cd" command and go to that directory.

You can make tcsh behave the same way by adding the following lines to your .tcshrc file:
# Make command completion (TAB key) cycle through all possible choices
# (The default is to simply display a list of all choices when more than one
# match is available.)

bindkey "^I" complete-word-fwd

# Make command history (arrow keys) use history search operations
# (The default is to simply display the next item in the history list.)

bindkey -k down history-search-forward
bindkey -k up history-search-backward

# Turn on implicit cd operation
set implicitcd
Check out the tcsh 'man' page; there's quite a lot in there.

[Editor's note: There are numerous other articles here that speak of where to save these commands in your user environment. For Apple's recommendation on the matter, type:
cat /usr/share/init/tcsh/README
This details the preferred structure on OS X.]
  Post a comment  •  Comments (2)  
  • Currently 3.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (2 votes cast)
 
[13,110 views] Email Article To a Friend View Printable Version
Change a user's default shell UNIX
A MacOSXism that might throw more classically-aligned Unix folks is how to change a user's shell (or other passwd information, actually).

Classic wisdom suggests using standard methods such as vipw or chsh. However, these methods do not work under OS X, as I found out the hard way. If you try to use these methods which revolve around changing the passwd/master.passwd filles, you'll find that everything looks ok but that the system elements that use this information are ignoring your changes. This vexed me until I discovered that the true authoritative repository for this infomation is managed by NetInfo.

Read the rest of the article for the details on using NetInfo to change the shell, and some information on why this is advantageous over just setting the prefs in the Terminal application...
read more (242 words)   Post a comment  •  Comments (7)  
  • Currently 2.67 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (6 votes cast)
 
[57,848 views] Email Article To a Friend View Printable Version
A fix for shared dial-up connection issues UNIX
Hi, not sure whether this was posted already. I had problems sharing a dial-up (Modem) PPP connection. I want to use NAT for security reasons and found that only the first connection after reboot worked. Subsequent connects would fail due to NATD not rebinding the new PPP bindings. Restarting NATD fixed the problem. Luckily PPPD fires off some scripts in /etc/ppp depending on connection status. The following script restarts NATD after every successfull connect if you save it as /etc/ppp/ip-up (don't forget to make it executable):
#!/bin/sh - 
N_P=`ps -uxc -U root | grep ' natd$' | awk '{ print $2 }'`
if [ "$N_P" != "" ]; then
logger -i -t $0 "Sending SIGHUP to natd (PID $N_P)"
kill -HUP $N_P
fi
In that script you can, of course, kick off other useful stuff you only want to happen if the link comes up (e.g. sending spooled mail).
  Post a comment  •  Comments (3)  
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[4,698 views] Email Article To a Friend View Printable Version