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

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
  (2 votes cast)
 
[12,131 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 2.50 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (2 votes cast)
 
[8,608 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,058 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,335 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,238 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,233 views] Email Article To a Friend View Printable Version
Search 'man' pages UNIX
I recently found out that when viewing a man page you (via "man [command]") you can search it by using forward-slash. ie, / beewee would find the first occurrence of "beewee" and by hitting "n" it's like "Find Again" and it finds the next one.

I also found out about hitting "?" to see all the cool options that are possible while viewing a man page.

[Editor's note: I had no idea ... and of course (and this time I swear I checked!) there's no mention of these features in "man man".]
  Post a comment  •  Comments (15)  
  • Currently 2.60 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (5 votes cast)
 
[13,879 views] Email Article To a Friend View Printable Version
Install RAR archive expansion tools UNIX
I've been looking for a long time for a command line tool or sources or an application which can expand multiple rar archives on Mac OS X. And with a single google search, today I've found a Mac OS X port of unrar, unace and binchunker in a package called PC Tools for Mac OS X.

The tools are in a single package form, and the package installs them into /usr/bin. Then, just type from anywhere in the terminal:
 % unrar e archive.rar
% unace e archive.ace
And of course, it still works if you have multiple archives attached (.r00, .r01, r02...).

For binchunker, it will convert .bin/cue or .raw/.cue (made by any PC CD burning software) in .iso or .cdr (that can be burned with Toast).
  Post a comment  •  Comments (11)  
  • Currently 4.50 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (2 votes cast)
 
[30,536 views] Email Article To a Friend View Printable Version
List all known commands UNIX
Probably this is old news, only I didn't know. For a list of all available commands in the terminal (tcsh), type Control-x Control-d.

[Editor's note: This is one of the default key bindings in the shell. You can see a list of all defined key bindings by typing bindkey at the prompt.]
  Post a comment  •  Comments (1)  
  • Currently 0.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (0 votes cast)
 
[3,065 views] Email Article To a Friend View Printable Version
Play solitaire on XWindows UNIX
I love to play a relaxing game of solitare but the only games I had ran on classic which I try not to use. Then I found Pysol Solitare. To run this, you need Python and several libs which can all be installed with fink. Note I could not get this to run with MacPython.

Just download the tar.bz2 move it to your home directory and gnutar it:
gnutar -xzvf pysol-4.80.tar.bz2
Move the pysol-4.80 folder to a handy place (I used Shared) and rename it pysol so you don't have to remember the version. You could leave it in your home folder but don't be a piggy as everyone will enjoy this.

At the terminal then type:
/Users/Shared/pysol/pysol
to run it. Enjoy!

[Editor's note: I have not tested this myself, but it looks like a nice Solitaire collection if you have XFree86 installed and running.]
  Post a comment  •  Comments (5)  
  • Currently 0.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (0 votes cast)
 
[5,243 views] Email Article To a Friend View Printable Version