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

Counting files in a directory from the terminal UNIX
Sometimes, it's the little things. I was trying to replicate an error someone was experiencing involving a large number of files in a directory. So I made my large directory, opened a terminal, then did an "ls" on the directory. Everything scrolled by, and then I noticed that there's no total file or total size information. Size information is easy to get (type "du directory_name"), but how do you know how many files are in a directory in the terminal?

Given my basic UNIX skills, I headed to the "man" pages for "ls", but found nothing useful there. Same thing with "man du". I finally had to use a lifeline and phoned a friend ;-). The answer definitely speaks to the sometimes non-intuitive nature of UNIX, but also shows how you can pretty much make it do what you want by combining commands.

To count the number of files in a directory, enter:
cd directory_to_count
ls | wc -l
That's the "ls" directory listing command, the vertical bar (which 'pipes' the output of "ls" to the next command), and then the "wc" word count command with the "l" (lower-case L) option to count the number of lines instead of characters. The output of this command is the number of files in the directory. Subdirectories count as one entry; the files in the subdirectory are not counted.

Of course the GUI is much easier, but if you're connecting remotely via SSH, you won't have that option available!
  Post a comment  •  Comments (4)  
  • Currently 5.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (3 votes cast)
 
[32,584 views] Email Article To a Friend View Printable Version
Customizing the OS X keyboard map System
There have been a couple of help requests for remapping the OS X keyboard. There's very little info out there right now about this topic, but I just stumbled across a bit of evidence that it should be possible, although more difficult than it has been in the past.

Reading the MacAddict forums, I came across a thread called OS X Key Mappings. In that thread, there's an email posted from Marcel Bresnick, the author of "PrefEdit," who also has written some OS X Server 1.x keyboard mapping hacks. Here's a snippet of his response on customizing the OS X keyboard maps:
The keyboard layouts are stored in:

/System/Library/Frameworks/Carbon.framework/Frameworks/
  HIToolbox.framework/Resources/*.lproj/Localized.rsrc

The * has to be replaced by the respective language name. Every language package contains 32 keyboard maps for _all_ keyboards, so there are in fact 224 (!) keyboard definitions. (This doesn't make sense, looks like a quick hack to implement Macintosh keyboards on top of Darwin...) If you want to do it right, you would have to repeat the keyboard redefinition for all language packages.
He goes on to explain how to edit the files (in theory, not step-by-step). Head on over to MacAddict and read the rest of the Marcel's email for an overview of how the process would work. Warning - this editing is not for the timid, and if you mess up, you'll have no keyboard -- so back everything up first, and make sure you know how to use single-user mode!
  Post a comment  •  Comments (6)  
  • Currently 5.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[87,864 views] Email Article To a Friend View Printable Version
Switch to 256 colors in Classic Classic
I have some older games on my PowerBook G4 that require that the monitor be set to 256 Colors. The Displays settings in OS X do not allow me to switch to 256 colors, so I had to boot into OS 9.1 to run these older games. However, on a hunch, I tried switching colors in the Classic environment's Monitors control Panel, and it switched to 256 colors and the games ran just fine.

Aqua doesn't like running in 256 color mode, but it got the job done!

Tom
  Post a comment  •  Comments (1)  
  • Currently 0.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (0 votes cast)
 
[6,787 views] Email Article To a Friend View Printable Version
Using Borland's JBuilder on Mac OS X Desktop
Hi Folks,

If you are a little familiar with the new tcsh-shell on Mac OS X, you can have a preview of working with JBuilder [editor's note: JBuilder is a commercial Java development environment from Borland which is due out shortly on Mac OS X natively]

If you have jBuilder and would like to see it running on OS X, read the rest of the article for instructions on getting the Linux version running on your Mac.
read more (119 words)   Post a comment  •  Comments (9)  
  • Currently 0.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (0 votes cast)
 
[9,984 views] Email Article To a Friend View Printable Version
Another method of OS X installer extraction Install
[Editor: There's a posted tip about extracting files from the OS X install CD. Here's another take on the process, as applied to the OS X Public Beta CD, but it should work on the final version as well. It's different and complete enough to merit its own thread.]

There were a number of posts on various OS X forums a while back asking where Music Player from the OS X Beta had gone. I was never able to install OS X Beta on my machine, but I had seen screenshots and really liked the look of Music Player. I decided to try and get it off the OS X beta CD. Here's how I did it...

Read the rest of this article for a detailed set of instructions on extracting files from the OS X installers.

read more (453 words)   Post a comment  •  Comments (1)  
  • Currently 5.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[10,709 views] Email Article To a Friend View Printable Version
Copy/paste to FirstClass (Classic) Classic
I found it impossible to copy an image in MacOS X and paste it into FirstClass (Classic). One way to solve the problem is to drag the picture from the web browser and down to Quicktime Player in the dock and then copy the frame/image in that application - after that I could paste it into FirstClass.

Midnightposer - mailto:olle@mac.com
  Post a comment  •  Comments (0)  
  • Currently 0.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (0 votes cast)
 
[3,663 views] Email Article To a Friend View Printable Version
Custom app icons that work in the Dock System
I'm sure most people have noticed by now that using the Show Info cut & paste method of changing an app's icon doesn't work quite as well as one would like. Specifically the app will revert to showing its original icon when in the dock. Here's how to change an apps icon(s) permanently...

To do this you may need IconComposer which can be found in /Developer/Applications after installing from the Developer CD. I say "may" because you can do it without this tool if you just want to substitute one app's icons for another's.

For this explanation we will give Sherlock the icons from Chess. Hey, its just an explanation.

Read the rest of this article if you'd like a step-by-step on replacing an app's icon more permanently than copy/paste appears to...
read more (326 words)   Post a comment  •  Comments (2)  
  • Currently 0.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (0 votes cast)
 
[5,755 views] Email Article To a Friend View Printable Version
Quick ASCII character table view UNIX
I've seen a few applications on VersionTracker to display the ASCII character set.

If you don't need a fancy GUI, open a terminal and type man ascii instead.
  Post a comment  •  Comments (2)  
  • Currently 4.50 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (2 votes cast)
 
[8,173 views] Email Article To a Friend View Printable Version
Mail.app and sendmail Apps
[Editor's note: See Geoff's comments; apparently this only works the first time you try it! There's an alternative suggested in the comments which may work better.]

I have managed to get Mail.app to handle sendmail mail by cheating... I am assuming that you're running sendmail OK but have been using mail or pine or somesuch to read mail.

Do this:

in the terminal, copy the folder heirarchy of another of your mailboxes (in ~/Library/Mail/Mailboxes).

Switch into the newly created directory, and instead of mbox, do:

ln -s /var/mail/user_name mbox

where user_name is your username. Restart Mail.app and you should now be able to manage mail downloaded from sendmail in Mail.app

If anyone knows a better way, preferably from within Mail.app instead of silly hacking, please let me know!!!

Cheers,
Geoff Saulnier - Mac, *NIX, perl, hack!!

[Editor's note: I'm not running sendmail locally, so I have not tried this myself]
  Post a comment  •  Comments (5)  
  • Currently 1.75 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (4 votes cast)
 
[3,983 views] Email Article To a Friend View Printable Version
Access privileges after password change System
I recently changed my password as administrator in osX. Now everytime I want to do anything that involves the keychain I have to give my password whereas before it would let me have access automatically. This is particularly annoying when I want to access my email, (I use Eudora 5.1). Is there anyway to get my keychain to recognize my new password without me having to enter it everytime?
  Post a comment  •  Comments (2)  
  • Currently 0.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (0 votes cast)
 
[3,413 views] Email Article To a Friend View Printable Version