Open new iTerm tab in the same folder

Many times a day I’m in iTerm and use the command+T shortcut to open a new tab. I want this tab to open in the same folder I’m in, not the root folder, so I then have to annoyingly navigate back to the folder from the previous tab.

But there’s an easy fix for this!

Under Settings in the Profile tab, in the Working Directory section, select the button for “Reuse previous session’s directory” and bingo! new tabs will open in the same folder from the previous tab.

Profile settings
advanced settings

You can customize further by clicking on “Advanced Configuration” -> “Edit”, which adds options for new tabs, new windows, and new split panes.


Credit here


Make Hidden Apps Translucent in Mac Dock

I had no idea that you can make your dock icons transparent when you hide an app. In fact, I didn’t even know you can ‘hide’ apps….I always just either used ‘alt+tab’ to switch between apps, or minimized them.  So I learned something!

To make your hidden app icons turn translucent in the Dock, all it takes is a simple Terminal command:

defaults write showhidden -bool YES

Then, you need to restart the Dock, which you can do using

killall Dock

To reverse this setting, simple run “No” instead of yes

defaults write showhidden -bool NO

Oh, and also the keyboard shortcut for hiding an app is “cmd+H”

credit here

Add Git Autocomplete to Terminal

A nifty edition to the git command line is autocomplete. First, get the git completion script:

curl -o ~/.git-completion.bash

Then edit your ~/.bash_profile file to add the following code:

if [ -f ~/.git-completion.bash ]; then
  . ~/.git-completion.bash

(go here for help on editing your .bash_profile)

That’s it. Now you can type git and press Tab twice to get an autocomplete list of commands.


Open URLs and Applications from Terminal and Ruby Scripts

Did you know you can open applications directly from the command line in Terminal?  The command is open

To open a url in the browser from the command line, use


You don’t need quotes around the url. This will use the default browser on your machine.

The line

open /Applications/

will open the Applications folder in Finder.

To open a specific application, use the path to that application followed by the .app extension.

open /Applications/

(Airdroid is a great application for transmitting files from your computer to phone wirelessly.)
If you want to open Sublime Text from the terminal, you can use the command subl

subl .

Will open the current directory in Sublime Text.

If you’re writing a ruby script, use these commands instead:

system("open", "")
system("open", "/Applications/Adobe\ Illustrator\ CS6/Adobe\")

credit here

Double Press Tab in Terminal for List of Options

I accidentally found a really cool Terminal keyboard shortcut yesterday.  You may already know that Terminal will autocomplete a file name or method name if you press tab after typing a portion of the word.  For example:

Screen Shot 2014-12-31 at 8.14.50 AM

You can see I typed ls to list the files and folders in the current location. Then I started typing cd Fi to change the directory to “FiveMinuteChinese”. As a shortcut I can now press the Tab key, and Terminal will autocomplete the folder name:

Screen Shot 2014-12-31 at 8.18.42 AM


Now what I just learned was that if you press the Tab key twice, Terminal will show you a list of possible options. See the screenshot below:

Screen Shot 2014-12-31 at 8.20.18 AM


Here I typed cd C, then pressed Tab twice, and Terminal gave me a list of all files or folders that start with the letter “C”. Pretty cool huh? If you’re using irb or another console type environment, you can use this same shortcut to give you a list of possible methods or autocomplete method names.

Hope this is useful!

Take a Timed Screenshot in Mac

A very useful tool that I never knew existed until today.  Every mac comes with a utility called “Grab”, in the Applications > Utilities folder.

It’s basically a screenshot application, and it includes a feature for a timed screen grab, under the Capture menu.

Screen Shot 2014-08-25 at 4.05.01 AM

It will wait 10 seconds then take a screenshot. You can also use a terminal command:

screencapture -T 10 myscreenshot.jpg

The number 10 is the time delay in seconds, and of course the last input is the desired filename, which is saved in the users directory by defualt.

Credit here.