Find large files on a Mac using Terminal

Every few days, I had an issue where my startup disk was full and emptying the trash just wasn’t doing enough.

I found the following command online that searches a file system for files over 500MB and prints the file path. It identified files I had totally forgotten about as well as some huge files generated by apps I no longer used.

sudo find / -size +500000 -print

I then used the rm command to delete files. When deleting entire directories I used the recursive flag (be careful!)
rm -rf <directory path>

Kudos to

Remove all .svn folders in subdirectory

You may want to copy the contents of one folder to another, but if the original folder is already added to Subversion (SVN) you get an error when committing the new folder.

When a folder is committed to SVN, a .svn folder is added to each folder within the folder subdirectory. To un-add the folder from SVN, you simply remove this .svn folder.

To save time, you can remove all .svn folders within the folder subdirectory by using the following command.
Continue reading “Remove all .svn folders in subdirectory”

Mac OSX Shell Script to automate connecting to WiFi network

I have a Mac laptop running ‘Snow Leopard’ that occasionally will not connect to my home WiFi, even though other devices are connected to the network just fine.

I wrote a small shell script that uses the networksetup command to reset AirPort. If WiFi is still not connected, the script tries to assign the AirPort WiFi network directly. If that doesn’t work, it just resets AirPort again.
Continue reading “Mac OSX Shell Script to automate connecting to WiFi network”

Here is a good guide on how to exclude files and directories from SVN.

Serge Desmedt

Excluding files from your repository
Sometimes you may have types of files or folders in your source code tree that you do not want to include in your source code repository. Everyne developing with Visual Studio will immediately know what I mean: VS automatically makes bin and obj subfolders for your project folder in which it puts the buildresults and also creates *.suo files with your personal settings for a solution.

It would be convenient if we could exclude these files from our repository once and for all without having to manually uncheck them each time we update our project. Fortunatly, Subversion allows us to do this. In fact, there are two possibilities for exclusion.

Global exclude

With the global exclude we can exclude a certain type of file of being added to any repository to which a certain client connects. To do this, you must edit the Subversion “config”…

View original post 406 more words

How to access attached screen after connection dropped

Here’s the situation, you are using bash’s Screen command because you don’t want your flakey internet connection to affect whatever you are working on, and sure enough, the connection drops. Sometimes, when you try to re-attach to this screen session you are told that the screen session is still attached…

~$ screen -r '1234.somescreensession'
There is a screen on:
1234.somescreensession (Attached)
There is no screen to be resumed matching 1234.somescreensession.

How annoying.

Here is a simple way to take back that screen session.

screen -D -r '1234.somescreensession'

Kudos to Donncha O’Caoimh

Here is a way a longer way to remove the process that is attached to that screen session, so you can reattach to it and continue with whatever you were doing.

  • figure out which tty is holding on to the screen session by typing into terminal
    ps -ef | grep screen | grep tty
  • result of this should be something like
    testdev 5760 5688 0 12:31 ttyp1 00:00:00 screen -r 1234.somescreensession
  • in this case the tty is 5688, use this to find the login bash that is associated with that tty
    ps -ef | grep bash | grep 5688
  • result of this should be something like
    testdev 5688 5687 0 12:28 ttyp1 00:00:00 -bash
  • kill process
    kill -9 5687

Now you should be free to re-attach to this screen session.

Kudos to David Mackintosh 

Uninstall and Remove Xcode Completely

If you are in a position where you want to remove the colossus that is Xcode, here is the terminal command to use.

sudo /Developer/Library/uninstall-devtools –mode=all

In my case, I was using migration assistant to migrate my applications and user account to a new laptop. My older laptop had an older version of Xcode that I didn’t want included in the migration and as it is so big, I didn’t want to take the chance.

Kudos to