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

Accessing UNIX folders in the GUI via the Terminal UNIX
While looking for an easy way to access root UNIX directories in Finder, I have found following: Typing 'open /usr' in the terminal will open Finder window with the appropriate unix directory (in column view as a folder 'Private'). Also, typing 'open /private' will open a window with the root directories 'cores', 'Drivers', 'etc', 'tmp' and 'var'.

[Editor's note: You can also use the "Go -> Go to Folder" menu item and type the path to the folder to open a sub-folder; this doesn't seem to work (thanks sjonke!) for top-level folders.]
  Post a comment  •  Comments (5)  
  • Currently 0.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (0 votes cast)
[6,879 views]  View Printable Version
Perl LWP modules and UNIX 'head' file UNIX
The LWP suite of Perl modules and applications is a popular choice for developing powerful automated web clients in Perl. However, if you install it under Mac OS X, it could make a dangerous change to your system (if Mac OS X is installed on an HFS+ file system).

LWP creates an executable program called /usr/bin/HEAD. Because the file system is case-insensitive, this ends up replacing the essential Unix utility called /usr/bin/head. After you install LWP, you can rename /usr/bin/HEAD to /usr/bin/HEAD_LWP, and copy /usr/bin/head from your Mac OS X install CD. I learned about this problem from:

- Brian
  Post a comment  •  Comments (9)  
  • Currently 1.50 / 5
  You rated: 2 / 5 (4 votes cast)
[15,946 views]  View Printable Version
View Printable Version

Free units conversion app in OS X

UNIXNot sure if this is exactly news, but it's a big help for any other students in science classes out there or anyone else who needs to occasionally convert picometers to fathoms. In the terminal, just type units, which is a UNIX app that knows how to convert between 501 different units of measurement, everything from inches to furlongs to stones.

[Editor's note: Type "man units" to get a couple of useful pages that explain how to use the program. Note that it will not do Fahrenheit/Celcius, but it looks like it can handle almost anything else!]
Change your hostname from 'localhost' UNIX
If you're like me, you've been terribly frustrated by the fact that "hostname name" doesn't permanently set the hostname under MacOS X. After a lot of (unsuccessful) poking around, I finally found a note on the macosx-admin group hosted by

Edit /etc/hostconfig with your favorite editor. Change the line



HOSTNAME="your favorite name"

Works like a charm! Still, it bugs me that Apple has disabled many of the old unix standards - I think they'd make the platform much more attractive to a very strong unix talent base if they would try to keep the old standards where they still make sense.


  Post a comment  •  Comments (8)  
  • Currently 3.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (2 votes cast)
[33,680 views]  View Printable Version
Dynamic terminal window titles UNIX
I learned about this in college to make the title of xterms dynamic and found that the same method works with I've created some aliases that allow me to have the title of the window reflect the machine that I'm on and current working directory of the shell, or of what file I'm editing. If you'd like a title on your terminal window that changes based on what you're doing, read the rest of this article...
read more (347 words)   Post a comment  •  Comments (7)  
  • Currently 4.00 / 5
  You rated: 4 / 5 (3 votes cast)
[15,521 views]  View Printable Version
Another way to get to your home directory UNIX
I don't know why but the tilde shortcut "~" to access my User Folder doesn't work for me (I get a "Permission Denied" alert). I've just discovered that "cd home" does exactly the same: it moves you to the user directory...I don't know if it's a common Unix feature or another alias made by Apple but it's neat!

  Post a comment  •  Comments (3)  
  • Currently 2.33 / 5
  You rated: 3 / 5 (3 votes cast)
[2,939 views]  View Printable Version
Use 'ShellShell' to learn UNIX UNIX
Robert Woodhead has written a very useful little utility called ShellShell, which basically wraps an Aqua GUI around the terminal. You launch ShellShell, and then pick any one of a number of 'macros', which will execute terminal commands in a GUI.

If that wasn't enough, one of the really neat features is that ShellShell will show you the command-line version of what you've asked it to do before it runs. So you can see how you would do the same thing in the terminal. For example, ps (Process Status) is a command-line version of Apple's ProcessViewer, and it has a large number of runtime options. When you first pick ps in ShellShell, you get a dialog box with about 15 choices in it, with two defaults (show all, and include processes without terminals (ie Aqua programs)) enabled. It shows you that the command line version of this command is ps -a -x. If you then add a check to "Display information about processes associated with user..." and enter your username, the shell command box changes to read ps -a -x -Uusername. This is a great way to learn the obscure command-line options that exist for many UNIX programs.

Once you've set the options you want, you click RUN, and ShellShell returns the results in another Aqua window.

If you're new to UNIX and the command line, ShellShell is a neat way to teach yourself about various options without trying to decode UNIX "man" pages or using the sometimes dangerous "try it and see what happens" method. Best of all, ShellShell is 'legoware'; if you like it, Robert asks you to send his children some Lego pieces (you'll have to see the details on the Read Me file).

ShellShell doesn't include every UNIX command, but it includes quite a few and is easily extensible. Hopefully authors will chip in with new "macros" for the program in the future.
  Post a comment  •  Comments (2)  
  • Currently 2.50 / 5
  You rated: 1 / 5 (4 votes cast)
[3,212 views]  View Printable Version
A guide for compiling UNIX programs UNIX
If you're interested in learning more about how to compile UNIX programs for OS X, I found a great reference on the X4U mailing list. This tutorial will walk you through the basics of downloading, expanding, configuring, and compiling UNIX programs. It's not specific to OS X, but it's a great overview of the process.

I've also added the URL to the links section of the site.
  Post a comment  •  Comments (2)  
  • Currently 3.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
[2,744 views]  View Printable Version
Safer file manipulation in the Terminal UNIX
By default in OSX, terminal commands like move (mv), copy (cp) or remove (rm) can overwrite or delete existing files without prompting you whether it's really want you want to do. These commands can be dangerous to use especially when using * for designing multiple files. To be automatically prompted for confirmation before each file is processed, create yourself a .cshrc file in your home directory and put the following lines
alias mv 'mv -i'
alias rm 'rm -i'
alias cp 'cp -i'
Another thing I find very useful is to have the target directory listed automatically when issuing a cd command. This can be done as well by adding the following line in your .cshrc file:
alias cd  'cd \!*;echo $cwd; ls -FC'
For these changes to be effective, type source .cshrc or open a new terminal window.

[Editor's note: Please see this related conversation on aliases in another macosxhints' posting. Aliases can live in a number of locations; .tcsh is one of them, but the referenced article gives an alternate, (possibly better?) location for these types of files.]
  Post a comment  •  Comments (5)  
  • Currently 2.50 / 5
  You rated: 3 / 5 (2 votes cast)
[3,012 views]  View Printable Version
View nicely formatted 'man' pages UNIX
If you'd like to read the "man" pages (UNIX manual pages) in PDF mode, here's how to do it.

The following shell script displays high quality man pages using (or whichever PDF viewer the finder thinks to use):
set m=`man -w $1`
set c=`grog $m`
$c | ps2pdf - /tmp/$1.pdf
open /tmp/$1.pdf
Save the script in your personal bin directory, e.g. ~/bin/superman. Set execute permissions: chmod +x ~/bin/superman. And then superman ls will present nicely typeset man pages.

NOTE: In order for this to work, You'll need ghostscript installed for ps2pdf.
  Post a comment  •  Comments (7)  
  • Currently 2.33 / 5
  You rated: 1 / 5 (3 votes cast)
[6,021 views]  View Printable Version