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

Add full ANSI color support to Terminal.app UNIX
I was becoming fairly frustrated with terminal.app because it would not do a good job of displaying ANSI color. I found a hack that would let me display colors with ls, but mutt, lynx, emacs and so on would stubbornly stay in black and white. The solution is to make the proper terminfo file for a VT100 terminal (which is what terminal.app more or less emulates) with color support.

Read the rest of the article for the how-to...
read more (210 words)   Post a comment  •  Comments (52)  
  • Currently 2.67 / 5
  You rated: 4 / 5 (6 votes cast)
 
[101,391 views] Email Article To a Friend View Printable Version
Convert 'man' pages to text files UNIX
I can't really take credit for this as it came straight from the Unix Guru Universe Tip of the Day (subscribe). To save a copy of any man page to text simply type:
man command_name | col  -b > output_file_name
For example:
man grep | col -b > grep.txt
This can be especially useful for larger man pages (tcsh, for example), as you can now open and work with the text file in any GUI text editor.
  Post a comment  •  Comments (5)  
  • Currently 3.00 / 5
  You rated: 3 / 5 (5 votes cast)
 
[6,883 views] Email Article To a Friend View Printable Version
An AppleScript front end to 'calendar' UNIX
Now that we have all these cool Unix utilities I decided to unleash some AppleScript upon them. The following script will display the output of the calendar command in a dialog, allowing you to then place the contents on the clipboard. Paste the following into script editor, modify to your liking and compile:
set n to do shell script "calendar -f ~/Library/calendar"

display dialog "Calender:\r" & n buttons {"Clipboard", "OK"}¬
default button 2
if the button returned of the result is "Clipboard" then
set the clipboard to n
display dialog "The calendar is on the clipboard." buttons¬
{"Cool"} giving up after 10 default button 1
-- the "giving up after 10 " part basically assumes it's cool
-- after 10 seconds of inactivity and removes the dialog
end if
Some notes to help make this easier to use:
  1. Create the calendar file first with touch ~/Library/calendar, and then edit it to add your entries.
  2. Read the man pages for calendar (man calendar) for information on how to format your calendar file.
  3. There are some sample calendars in /usr/share/calendar; to see the script in action, try using /usr/share/calendar/calendar.computer (or any of the others in that directory) in the first line after the "-f". You can also add extra options (-l 30 to show the next 30 days, for example).
Save the script in compiled mode, and then just double-click any time you'd like to access the calendar file.
  Post a comment  •  Comments (4)  
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[9,549 views] Email Article To a Friend View Printable Version
A few scripts to help with Pine integration UNIX
I installed Pine on my OS X box, and love it. It is the only email program that can keep up with my volume of mail. It is text only, but there is nothing that can touch it for speed and power.

But I wanted to get Pine to play a little nicer with my system. So I wrote a few scripts to:
  1. Open URLs without having to copy and past them.
  2. Print via the GUI print system (via PDF)
  3. Handle attachments so I could view them without having to save them first.
I typed out some quick steps on how I did this for my own use, but thought others might like to look at them as well. Rather than turning them into HTML, I just dumped the text files on my iDisk, listed under the "Pine Tricks for OS X" link.

[Editor's note: I have not used these scripts myself (I'm having enough trouble mastering Mail. app ;-), but I did glance at them and they seem to be well-written instructions with simple, straightforward scripts.]
  Post a comment  •  Comments (12)  
  • Currently 3.00 / 5
  You rated: 4 / 5 (5 votes cast)
 
[13,312 views] Email Article To a Friend View Printable Version
Save command history from multiple shells UNIX
So I was setting up my multiple windows in the Terminal according to this article on O'Reilly's site (upon searching Mac OS X Hints, I found similar tips 1 & 2). Everything was looking and acting great. I created three windows that would open up when I launched Terminal (one for man pages, one for working, and one for misc commands).

Now as long as each window remained open, that window had its individual command history. However, when I logged out of all my windows individually and either restarted Terminal or opened a new terminal window I found that the majority of the commands I had used in all of the windows were NOT saved. As I did some testing I found that only the command history of the last window I logged out of was saved to .tcsh_history. After some reading of the man page for tcsh (shudder), I came up this little nugget of information:
history -S|-L|-M [filename] (+)

With -S, the second form saves the history list to filename. If the first word of the savehist shell variable is set to a number, at most that many lines are saved. If the second word of savehist is set to 'merge', the history list is merged with the existing history file instead of replacing it (if there is one) and sorted by time stamp (+). Merging is intended for an environment like the X Window System with several shells in simultaneous use. Currently it succeeds only when the shells quit nicely one after another.
So off to my .tcshrc file where I entered set savehist = (50 merge). Voila! Now the last 50 commands from all the windows are saved.
  Post a comment  •  Comments (9)  
  • Currently 3.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (4 votes cast)
 
[13,065 views] Email Article To a Friend View Printable Version
Realtime alias creation for GUI app launches UNIX
Previous hints have discussed how to create aliases that allow you to launch Mac OS X applications from the Terminal. However, these hints do not comply with Apple's recommended format for extending the OS X shell.

The following two scripts correct this. In addition, they also support creating aliases for applications that aren't in the /Applications directory. The biggest benefit of using these scripts is that they will automatically detect whenever you install a new application, and rebuild the appropriate aliases file!

[Editor's note: I have installed these scripts, and they do exactly what they're supposed to do - they create command-line aliases to all your applications on the fly. Quite cool...]
read more (335 words)   Post a comment  •  Comments (16)  
  • Currently 3.60 / 5
  You rated: 5 / 5 (5 votes cast)
 
[8,915 views] Email Article To a Friend View Printable Version
Install a command-line DNS tracing tool UNIX
There is a useful command-line utility known as 'dnstracer' written by Edwin Groothuis. dnstracer is available (in source code form, requiring compiling) from his web site.

It shows you which servers are responding to your DNS queries: those that have cached info and those which have the authoritative info. It seems like this would be very useful for debugging DNS problems.

I had no difficulty at all in compiling this. Following the instructions in the README, I ran ./configure and then make. I already had the Developer Tools from Apple, which are required to compile source code.
  Post a comment  •  Comments (10)  
  • Currently 2.50 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (2 votes cast)
 
[7,515 views] Email Article To a Friend View Printable Version
Run an IBM 3270 emulator in XDarwin UNIX
Need a TN3270 emulator, but are tired of waiting for a native app (or waiting for Classic to launch) while an impatient operator/user sits on the line? I use XDarwin (rootless), OroborOSX, and x3270. Read the rest of the article for the how-to...
read more (165 words)   Post a comment  •  Comments (2)  
  • Currently 2.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (2 votes cast)
 
[4,706 views] Email Article To a Friend View Printable Version
April Fool's Day php Easter egg UNIX
Thanks to djidji for pointing this out in this thread on the macosxhints OS X Developers Forum. It's completely useless, but it is April 1st, so it seems fitting to publish it here today!

The php developers have a small April Fool's Day Easter egg hidden in the PHP code. If you have PHP enabled and working, just create a small PHP file that contains the standard "show install information" PHP command:
<? phpinfo(); ?>
Load this file in your browser, and check out the new PHP logo. You'll only see this, of course, as long as your system shows the date as April 1st.
  Post a comment  •  Comments (0)  
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[4,450 views] Email Article To a Friend View Printable Version
List libraries associated with an application UNIX
For those trying to find out what libraries are tied to an application (ie. ldd in linux) you can use otool -L FILENAME:
 % otool -L /usr/bin/ftp
/usr/bin/ftp:
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0,
current version 55.0.0)
The actual output is on two lines; shown here on three to minimize article width.
  Post a comment  •  Comments (0)  
  • Currently 0.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (0 votes cast)
 
[3,409 views] Email Article To a Friend View Printable Version