How I like to code

Tag Archives: Terminal

You can run Swift code from the command line?

WAT? Now this is something else! practicalswift.com

Finding the “file in use” culprit in Mac OS X

Thank to a tip at MacWorld, I was able to find out what process was locking a file I wanted to delete. lsof | grep [whatever]

List open files

On the Mac OS, if you need to know what files are open and by what application and on what disk, you can use the lsof command in Terminal. Pair that command with grep and you can isolate things like this: ?View Code BASHlsof | grep "Snow Leopard" This will show you what files are […]

Running AppleScript commands from the Terminal.app

I found some pages on the web on how to run an AppleScript from the terminal, but this seems to be the only one that works in my situation: ?View Code APPLESCRIPTecho ‘tell application "Google Chrome" to quit’ | /usr/bin/osascript In my case, my keyboard stopped working so I wanted to safely shut down the […]

Getting rid of build directories

I wanted to get rid of the “build” directories in my source folders before prepping my source folders for git, so I used the following command to get rid of them: ?View Code BASHfind . -iname "build" -type d -print -execdir rm -R ‘{}’ \;

Recursively deleting folders

While I was looking at my backup log in Retrospect, I saw an error message about a directory had more than 100 folders deep. What? I took a look and sure enough, Entourage had gone on a folder making frenzy and had created well over 100 folders within each other: My Project.rge/My Project.rge/My Project.rge/My Project.rge/My […]