The following will search the current dir (and subdirs) for any files that contain identical content and are of identical size, regardless if they are named differently. Open a terminal shell, and 'cd' to the dir you want to search, then type:
[Editor's note: I inserted a carriage return for readability -- type the command on one line when entering it!]
This will produce a list of duplicate files (if any) in dup.txt. True there are some nicely written apps that will do the same thing, but ain't it great that you can do this right from within your OS?
This will ignore files that are smaller than 10k. (remove/alter the '+size 20' to change this). But a warning: really small files may produced identical CRCs. i.e. show up as duplicates even if they really aren't.
If you want to search a filesystem you don't own (i.e. /) you'll need to sudo or su or 'find' will complain.
The built-in cksum cmd only uses CRC32. MD5 would be better. Anyone know why it's not enabled under OSX?
If you're gonna write a script to delete the duplicates from the produced dup.txt list, just remember that it contains ALL instances of the duplicate files.
This has become a major area of frustration for me. Specifically, I'm trying to get the command line version of setiathome to kick off on startup (and automatically if it goes down). In the past, I've had no problems with getting the Rhapsody version of seti@home running in a cron job, but that was before MacOS X as we know it came along. To make a long story short, I have tried every variation of users' crontabs to get this line in the cron execution pipe, and nothing seems to want to kick the process off. I have even resorted to Cronnix (excellent app) to get the job done. The line as it appears in my various crontabs:
0 * * * * cd [path to my seti dir here];[space] ./setiathome -nice 19 > /dev/console 2> /dev/console
[Editor's note: Line break inserted for readability; it's really one line, and replace '[space]' with a true space character.]
I'm on the verge of giving up, but postings on this site have given me hope (someone is making this command work).
Perhaps I'm missing something really obvious, but in any case, I need help. How do you make a cron job kick off? What am I missing -- or misunderstanding? Links to a good Cron or MacOS X (or FreeBSD) UNIX tutorial?
In the spirit of learning from others' mistakes, I'm sharing the following slightly embarassing story.
In the process of trying to use my web host's Linux OS "tar" command to compress a directory while excluding another, I managed to create a file called "-X". When I went to delete the mistakenly-named file, I quickly found myself stuck. Typing "rm -X" didn't work, because 'rm' interprets the "-" as the sign for a command-line switch, and it doesn't know what to do with "-X" as an option, leading to "unknown option" errors.
Thinking I was smarter than the box, I then tried to use the various UNIX quote characters to 'mark' the hyphen: rm "-X", rm \-X, and rm '-X'. None of these worked; each generated the same error message about unknown options. On my Mac, I would have simply used the GUI and dragged the file to the trash. On the Linux box, though, I was stumped - no GUI available, and a badly named file stuck in my directory.
One amusing ("You won't believe what I've done now...") call to a UNIX-knowledgeable friend provided two options. The first is to use two hyphens to let 'rm' know that there are no command-line switches: rm -- -X. The second is to refer to the file via its relationship to the parent directory: rm ./-X. Either of these will work just fine to delete the file (or you could use "mv" with the same syntax to rename it if you want to keep the file).
At least with OS X we have the option of using the GUI to correct our stupid mistakes! As such, there's an easy way out for X users ... but perhaps this story will save someone some command-line frustration at some point in the future. And please, all you advanced UNIX wizards out there, hold the snickering to a minimum! ;-)
Hello, I've sucessfully installed Ruby, a great newish scripting language. I recommend you try it out. Anyways, it works fine by itself, but I am having problems getting it to work as a script in Apache. I've installed mod_ruby, and have followed their directions. However, I can still not get it to work under Apache. Anyone had any luck?
Opera was crashing on me constantly, so I decided to trash my Opera preferences. Little did I know (until I was emptying the trash) that my Opera prefs folder contained 38,000 items! After waiting for about 10 minutes, I still had 35,000 items left to empty. I decided to bail out and do it from the command line, where it took approximately 15 seconds! A simple rm -r * to empty my .Trash folder did the trick.
[Editor's note: If you're new to the terminal, be very careful with the 'rm' command. There is no going back, and there's no confirmation (by default). To do this safely, you should first type cd ~/.Trash (to make sure you're in your trash directory) and you may want to use rm -ri * which will ask for confirmation on each file. Although this won't be fast, you'll be confident you're deleting the right files before they're all gone! A wise friend once said to me that there are two types of UNIX users ... those that have "rm -r *"ed the wrong directory, and those that will...]
If you'd like to get PostgreSQL and PHP running on Mac OS X, the following tutorial should help. Please refer to my previous instructions on installing Apache, PHP, MySQL in this web site to make these instruction clearer.
- Vip Malixi.
[Read the rest of the article for the step-by-step instructions]
[Editor's note: Submitted by phlbbrtn on Sat Jul 28]
I came to Macs from being a PC Linux user previously. One thing I have missed in the Macintosh world is my all-time favorite mail reader -- Pine. Pine is a plain-text Mail User Agent. It is designed to be used primarily on networked UNIX systems. Thus it is not set up to perform all the functions of Mail.app or Outlook Express. All you can do with it is read, write and send mail. It also has an Address Book. But for accessing your mail you need a Mail Transport system like Sendmail, Postfix, or Qmail. For POP mail accounts you need, in addition, something like Fetchmail to get your mail from your ISP.
I had been wondering, since installing OSX, if there was a way to use Pine in OSX -- as a Terminal program. The trouble with that is that you would have to make the effort to configure Sendmail [editor: and this has been described to me as one of the tougher things to do in UNIX!]. But mine is a single-user Mac with an ISP and a POP mail account. Sendmail is overkill. Yesterday I figured out how to do it.
Read the rest of the article if you'd like a step-by-step guide on how to install and use Pine with your POP-based email accounts.
This is probably one of the oldest ones in the book, but for the new UNIX users out there...open a terminal and type "Bill Gates" (without the quotes) and read the response for OS X's opinion of what you're trying to do.
This friendly advice is due to the shell trying to 'correct' what it thought you might have typed incorrectly. There are probably hundreds of others like this, but this one seems to get the most notoriety, for obvious reasons.