Find Duplicate Files in MacOS

In the past I’ve used FSLint or even some BASH magic to find duplicate files but I have a huge archive of photos and videos, some of which were renamed during import, and some were accidentally imported more than once, or moved about. It’s somewhat chaotic


So I was very glad to find dupeGuru! It’s a powerful application for MacsOS and Linux that allows you to scan one directory or more for duplicate files. It can search by content, or match filenames. It has modes for music and pictures, but I’ve stuck with the standard search as I want to only look for files that are 100% the same.

It found several gigabytes of duplicates for me, and it has a useful feature that symlinks duplicates to their parent. Even though the dupes still exist, they’re not taking up any space.

The developer is looking for help to maintain the project. You can find more information and source code too on the dupeGuru GH page.

For the love of Vim

A contributor to the Hackaday blog has a good old rant about how Vim is superior to Emacs. 

Of course it is (a silly argument), but he manages to give a quick overview of Vim and describes a few neat tricks beginners will find useful!

And after writing the text above I realised that there are going to be people reading this who have absolutely no idea what either Vim or Emacs are! They’re text editors, and they have passionate users. Yeah, that includes me too. 🙂

Throwing away old clothes

I hold on to things for way too long! The last four weeks have felt like a continuous purging of old “stuff” with several trips to the Kinsale Road site (BTW, it was a bit creepy to see a guy rummaging around in the electrical bins as soon as I dumped stuff in them, he could at least have waited until I left), and there’s still more to go. At least now I can walk around the attic without tripping over random objects.

set -o vi FTW

The Bash command line can be edited using the cursor keys but for the real power user you need to enable Vi mode:

$ set -o vi

Or add it to one of your Bash startup files.

Now, instead of the slow interactive editing you’ll get the command and insert mode of Vi! Users of Vi or Vim will feel right at home. You start in insert mode by default so it feels the same as before. You can type new text, move left and right with the cursor keys and delete text but press ESC and you can do all the things Vi command mode allows you to do.

Check out this extensive cheat sheet with examples or jump directly to the ascii version here!

Go on back to Linux will ya!

I’m back in the world of Linux on my desktop machine again. Well, mostly.


Desktop Linux has been a “thing” for so long now it’s a cliche but I used it as such for well over a decade and it wasn’t until I was lured away by the shiny games offered by Steam that I installed Windows on a machine. Well, time passes and Linux support for games improves. Many fabulous indie games now have Linux versions. I’m glad I can play Kerbal Space Program, Prison Architect, Papers Please, Luftrausers and more without booting into Windows!

I’m mostly back in the Linux fold. There are still apps I use regularly that don’t work in Linux. Lightroom and Ynab are the main offenders. Both run to a certain degree in Wine, and the latter runs quite well, but I’m afraid I’ll be cheating on Linux. I have a Macbook laptop here too that runs Lightroom just fine. My 1TB of photos (and some videos) resides on an external drive in my Linux box but with the catalog copied over to the laptop, Lightroom runs reasonably well.

It hasn’t been plain sailing either. I corrupted one external drive when I let Ubuntu try to resize and partition it. It was probably my own fault for not defragging it first. I thought I had lost everything as Windows couldn’t see anything on it. Luckily, after booting into Linux on a USB flash drive I could see everything I wanted copied off.

I have an Nvidia graphics card and I noticed ugly tearing in web pages in Chrome. I found a page that suggested enabling “Override software rendering list” in chrome://flags/ but while that worked it also stopped my cursor changing when hovering over links and hover actions on menus didn’t register. Luckily I found this thread that suggested disabling the “Composite” module in the X server. (That’s the program that displays things in Unix)
I couldn’t find the file, /etc/X11/xorg.conf in my Ubuntu 14.04 install but I found Composite was mentioned in /etc/compizconfig/unity.ini and when I removed it, restarted X and logged in again Chrome scrolled like melted butter on hot scones. (yum)

Unity is a lot nicer than I remember it, or maybe it’s because I have a better machine now. I have no doubt I’ll get bored of it and start installing Gnome, KDE, Xfce and everything else to play with, before coming back to it again. I fondly remember the days of Windowmaker.

So, Linux is back.

Learning more about Vim

I mentioned in a tweet recently that I’ve been using some form of Vi for about twenty years. It all started in college where we had highly advanced green screen monitors attached to a large Unix box. I can’t remember what Unix it was ran on that machine (it may have been UnixWare) but it was a far cry from the nice GNU interface we’re used to on modern Unix systems. Vim certainly was not a part of the default install.

However, Vim has been my editor of choice all my working life. All this time I’ve known I’m only scratching the surface of it’s functionality but only recently has it become clear how much. I can navigate through it with ease, open numerous files in separate splits, search/replace and of course vimdiff was partly responsible for every single WordPress MU release as I used it to pull over changes from WordPress.

So, thanks to /r/vim I discovered the following today:

  1. /r/vim_magic is indeed full of magic.
  2. More Instantly Better Vim is a great talk on some insane things to do with Vim.
  3. I had no idea Vim had tabs but I still prefer splits.
  4. snipMate.vim is a snippet plugin for Vim based on the snippets in TextMate. Around the turn of the century I had messed with abbreviations but this is way better. Found that here where there’s plenty more tips to read.
  5. Coming home to Vim is the story of the return of a TextMate user to Vim. Why didn’t I know about daX and diX?
  6. Since I use split files, I’m always tapping CTRL-w w or CTRL-w UP/DOWN to switch between splits. It never occurred to me that I could map the TAB like this to switch split files. TAB switches to the next split file, SHIFT-TAB hops back.

    map <Tab> <C-W>w
    map <S-Tab> <C-W>p

  7. I am tentatively mapping ; to : with nnoremap ; : but I probably won’t use it. My fingers are too used to LSHIFT-; to stop now. I’ve never used the ; command, I had to look it up to see what it did!

From my tweet comes some productivity tips. I have never used the Leader key. The shame, the shame!

So much to learn. I’ll probably leave comments on this post linking to all the bits and pieces I find. Yes, I’m excited about a bloody text editor. Haha!

Linux: when the /boot is all full

I tried to install fdupes this morning on my Ubuntu Linux server but the install bombed out with this error, followed by a string of other warnings before dpkg rolled back everything:

gzip: stdout: No space left on device

What? I’d installed a 500GB drive in that machine recently. It was /boot/. A quick look in there revealed a number of old Linux kernels but luckily there’s an easy way to get rid of them.

This showed me a list of all my installed kernels, and “uname” told me the name of the current kernel which I shouldn’t remove.

dpkg -l linux-image-\* | grep ^ii

Removing them was as easy as this:

apt-get purge linux-image-3.8.0-29-generic linux-image-3.8.0-31-generic linux-image-3.8.0-32-generic linux-image-3.8.0-33-generic linux-image-3.8.0-34-generic linux-image-3.8.0-35-generic linux-image-3.8.0-36-generic

When I finally installed fdupes it kindly removed all the kernel headers saving me a further 505MB of space. I’m pretty sure this is the first time /boot has filled up on me.

fdupes is pretty nice too. It finds duplicate files by comparing file sizes first and then does MD5 checks.

Fix file (644) and directory (775) permissions in Linux easily

A few weeks back I was sorting out the drives on my Linux server and as some of the directories were created through various configurations of Samba by Windows clients the permissions were a bit odd. Some archive files were executable, some directories were rw only for the owner. You get the idea, it was a mess. How do I fix them quickly?

I’d like all the files to be 0644 and directories should be 0775 please. Oh, and I’d like all that done with the minimum of fuss through a Bash shell, with or without a cherry on top.

Luckily I’m not the first person to ask this as user stress_junkie in this thread had an answer:

For directories only do this.

find . -type d -exec chmod 775 {} \;

For files only do this.

find . -type f -exec chmod 644 {} \;

There’s also this useful chunk of code to avoid hitting . and .. but I didn’t care about that in my case so the above code worked perfectly:

find . -type d -name \* -exec chmod 775 {} \;

And finally, user Gethyn pointed out that this command will add execute permissions to directories.

chmod -R +X

I have a feeling I’ll be coming back to this post in the future, just like I’ve had to check my directory comparison post a couple of times recently.

Do more with your old MacBook

Have you got an old MacBook that Apple doesn’t support any more? Can’t install the latest and greatest version of Mac OS X on it because the CPU is too old? You’re probably seeing a warning from Chrome that Google has discontinued support for Mac OS X 10.5.3 or whatever is on that ancient beast? It’s the same with Firefox.

Flash isn’t updated either and when you go to Youtube to watch a video Chrome shows you an ugly warning that it’s outdated. Frustrating isn’t it?

What’s more, you’re probably leaving yourself open to exploits by nasties on the Internet. Problems and bugs are found in Flash all the time. Browsers and operating systems are the same too but if that software isn’t actively updated then you’re out of luck. I discovered Opera browser is still built for these old machines and it’s fast but Flash was still a problem and I needed a better solution.

As unlikely as it may seem on an Apple computer, it’s Linux that came to the rescue!

I didn’t think I could put Linux on the MacBook as there was no Bootcamp to dual boot the machine. Thanks to I found the MacBook help pages for Ubuntu which pointed me towards rEFIt, a “boot menu and maintenance toolkit for EFI-based machines like the Intel Macs.” Even on an old MacBook 4,1 I could install Linux!

Installing rEFIt was simple enough, just run the package installer when I mounted the .dmg file. However the boot menu didn’t appear, even after several reboots until I pressed down ALT while rebooting.

Partitioning was a problem. I used the command line diskutil tool as suggested here but ran into problems because it couldn’t do a live resize. It would report that it ran out of space or there were too many deep links. Luckily the Ubuntu install CD comes with Gparted and after booting into the live CD I ran that and freed up 40GB of space for my new Linux install. A couple of reboots later to verify everything was working and then on to Linux!

Thankfully I didn’t run into the problems a recent Ars reviewer of Ubuntu Linux 12.10 came across. Linux installs are getting simpler and simpler. I told it to install alongside Mac OS X and let it set up partitions.

The WIFI adaptor in the Macbook requires a proprietary driver and after hooking the laptop up to an ethernet cable I started updating packages. While doing that I looked in the System settings and discovered that Ubuntu had installed the right driver without my prompting! I’m not sure when that happened but WIFI has been rock solid since.

Time to install Opera, the restricted packages (mp3 and dvd playback, etc), Java for Minecraft and finally Minecraft. Getting a Minecraft icon for Unity was a pain and I can’t find the script I used now but some quick Google-fu will find it.

Linux on the MacBook is nice and fast, even with Unity on there. I may replace that with a lighter window manager if it becomes a problem but it’s much improved on older releases. If you have an old MacBook and you don’t need some proprietary software that isn’t available for Linux then you should definitely put Linux on there. You’ll have the security of using updated software and a nice new desktop and apps to play around with!