
Quick tip for developers who use OS X - gargarplex
OSX Terminal: hold option and click a position in the current line to move your cursor to that position. #yearslost
======
juanre
Bash, running in your terminal, understands both the Emacs and the Vi
commands. By default is Emacs, so you can C-a (control-a) for beginning of
line, C-p to go back in command line history, or C-r to search it.

I prefer the Vi mode, though. Add to your .bashrc

set -o vi

Then you can press escape to go from input mode to normal mode; there k will
take you to the previous line in command line history, j to the next line, ^
and $ to the beginning and end of the line, /something will search something
back.

Editing is really fast; move by words with w (forward) and b (backward), do cw
to replace a word, r to replace a letter, i to go back to input. It will
remember the last editing command, just as Vi, and repeat it when you press .
in normal mode.

~~~
bilalq
I use these settings in my .inputrc. The get me a few more commands and even
the ability to escape using jj.

    
    
        set completion-ignore-case On
        set bell-style none
        set editing-mode vi
    
        $if mode=vi
          set keymap vi-command
          "gg": beginning-of-history
          "G": end-of-history
          set keymap vi-insert
          "jj": vi-movement-mode
          "\C-p": history-search-backward

~~~
b-ryan
Thanks for this. I switched my input mode to VI and was greatly missing using
Ctrl-L to clear the screen when in input mode. I hadn't known about the
inputrc before. Adding this line below your "\C-p" line fixed that for me:

    
    
        "\C-l": clear-screen

~~~
tambourine_man
Command-K also does the trick

~~~
bilalq
Command-K won't play nicely with tmux panes though.

------
adventureloop
Another really useful command is the open

    
    
        $ open filename.png
        $ open .
        $ open -e filename.txt
        $ open -a Pixen filename.png
    

The first command will open the file with the default application.

Open . will open the current directory in finder, which I find very helpful.

The -e flag will open the file in textedit.

The -a will open the file in the given application name.

~~~
panzi
Under Linux there is a similar command: xdg-open

~~~
richardwhiuk
or gnome-open.

On Windows the equivalent is start (e.g. start C:\ )

~~~
Someone
I use start all the time, but also frequently curse at its stupid argument
grammar and its interaction with auto-quoting on auto-completion. For example,
type

    
    
      start C:\Doc
    

Next, hit tab to get

    
    
      start "C:\Documents and Settings"
    

Now, hit return, and watch a new command window open with title "C:\Documents
and Settings".

Reason? If the first argument is a quoted string, it is used as the title of
the window being opened
([http://www.microsoft.com/resources/documentation/windows/xp/...](http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-
us/start.mspx?mfr=true), [http://stackoverflow.com/questions/154075/using-the-
dos-star...](http://stackoverflow.com/questions/154075/using-the-dos-start-
command-with-parameters-passed-to-the-started-program))

If you ever use start in batch scripts, pass a dummy first argument of ""

~~~
krallja
You can use `explorer`, which doesn't exhibit this behavior:

    
    
        explorer "C:\Documents and Settings"
    

does what you'd expect.

------
guelo
After making the switch to OS X in the last couple years after living in Linux
and Windows before that, I think it's objective to say that keyboard shortcuts
in OS X are much worse in both ease of use and consistency across
applications.

~~~
natural219
Sorry, but this is laughable. Keyboard shortcuts are far more useful and
consistent across applications in OS X. I'm failing to understand how you
could form this opinion...which shortcuts / programs don't meet your
expectations?

I guess I can sum this up by saying OS X has an additional modifier key than
Windows, so you basically have 33% more power right out of the gate. The
"Windows Key" is nearly useless.

~~~
randomsearch
> Sorry, but this is laughable. Keyboard shortcuts are far more useful and
> consistent across applications in OS X.

I don't agree with this at all.

I find it baffling that a company of great designers made such _bad_ decisions
about keyboard shortcuts.

Perhaps they are consistent, but they are consistently bad.

Paste and match style (incredibly useful) is "alt-shift-command-v" i.e. four
keys. There are plenty of other shortcuts that also require four keys. Four is
too many. Three is too many for such an important function. This is absurd.

Using shortcuts in IDEs is a nightmare on most apple keyboard. e.g. Intellij,
to run your program: alt-shift-f10. This is daft in itself, but it actually
translates to function-alt-shift-f10 on many keyboards. Yes, you can change
your settings, but then you could remap all your keys in any O/S. Miss the
function key and you've just muted your volume.

I have no interest in slagging Apple off; I use their products almost
exclusively, but this is obviously an area where they messed up. I'd love to
see this fixed, although I understand why they probably won't.

~~~
podperson
"Paste and match formatting" shouldn't be necessary for most programs, and
isn't a platform standard. Paste is command-V. A sensible application should
do the most likely thing the user wants with paste and overload the shortcut
for weird stuff. The fact that Microsoft consistently does the weird thing by
default isn't a platform problem with the Mac, just with Word.

Now you could point out Pages has the same shortcut and same stupid behavior.
I agree, but that's what happens when there's a clear market leader.

(Oddly enough, I've been implementing a web-based word processor, and we make
paste-and-match (paragraph) style while retaining (character) styles the
default. You can't actually do this in Word or Pages — default or not —
despite the fact it's what users want 99% of the time. So if I paste some text
with an italicized passage, the font changes to match the ambient styling, but
the italics remain. When we implemented it, the UX people were flabbergasted
-- they assumed it must be impossible because no word-processor does it.)

~~~
Someone
_" Paste and match formatting" shouldn't be necessary for most programs, and
isn't a platform standard._

Yes, it is.
[https://developer.apple.com/library/mac/documentation/UserEx...](https://developer.apple.com/library/mac/documentation/UserExperience/Conceptual/AppleHIGuidelines/KeyboardShortcuts/KeyboardShortcuts.html)
says _" Table A-2 lists the system-reserved and commonly used keyboard
shortcuts mentioned in the rest of this document."_

Table A-2: contains ../art/ks_option_2x.png ../art/ks_shift_2x.png
../art/ks_command_2x.png V Apply the style of the surrounding text to the
inserted object (equivalent to the Paste and Match Style command). See “The
Edit Menu.” That links to
[https://developer.apple.com/library/mac/documentation/UserEx...](https://developer.apple.com/library/mac/documentation/UserExperience/Conceptual/AppleHIGuidelines/Menus/Menus.html#//apple_ref/doc/uid/TP30000356-TPXREF127),
which describes the command, too.

I disagree with the claim that this is a bad choice, though. It may not be
optimal if starting from a tabula rasa, but Apple did not do that when it
introduced the combination, five years ago or so, in my memory. By that time
Command-V has done styled paste for about 25 years, making it difficult to
dethrone.

We must be glad that we have a standard for this, not angry that it may be a
bit complex to type.

~~~
podperson
OK I didn't know Apple had made that a standard -- so I agree with the GP that
it's dumb. If I can't easily type a shortcut with one hand, it shouldn't be a
standard shortcut.

I'm suggesting the standard paste should behave as expected, not adhere to
some literal definition the user doesn't care about. If I copy a passage of
text from one document and paste it into another, I generally want it to look
like it belongs in the destination document but I don't want to lose obvious
intentional styling such as italicization.

The common case should be the easy case. Instead we have the common case and
the four-fingered shortcut both doing the wrong thing. Awesome.

~~~
Someone
I think implementing "obvious intentional styling" is an AI problem. Suppose
you copy a header, click in a normal paragraph, and paste. Keep styling
information? Case 2: copy styled text from Keynote, and paste. Keep styling?

Maybe, the logic in a word processor should be to keep character styling, but
not paragraph styling, but I think there will be many edge cases (for example,
the user might be using the word processor as a document layout package)

I doubt those edge cases can be programmed away; user intervention is
required. Microsoft solves that after the paste. That may be the better
solution.

~~~
podperson
You can't program away edge cases, but the current standard behavior fails in
the bog standard common case.

------
natch
Useful when copy/pasting things to share with other people in email and such:

    
    
        $ pbpaste | pbcopy
    

takes the current contents of the copy/paste buffer and removes
color/font/background color rich formatting and puts just plain text back into
the paste buffer.

And of course pbcopy and pbpaste are also very useful on their own.

~~~
Janteh
You can also use shift-option-cmd-v to directly paste without markup :)

~~~
natch
I can never remember which combination that is, but thanks.

~~~
jmreid
You can override any key combination using the Keyboard preferences.

Just make a new shortcut under the All Applications group named exactly the
same as the one you want to replace.
[http://i.imgur.com/JqBncTy.png](http://i.imgur.com/JqBncTy.png)

I've also had to add an entry for "Paste as Quotation" because that's Mail's
default use of Command-V.

------
ancarda
Nobody seems to have posted this yet:

    
    
        python -m SimpleHTTPServer
    

I'd recommend an alias like "serve". It basically puts the current directory
online (binds to 0.0.0.0:8000).

~~~
verandaguy
Am I wrong to have long dismissed this as little more than an easter egg, or,
at best, a toy server to test basic webpage functionality?

~~~
ramses0
Yes. It's like a ghetto SCP for giving files to people on windows who don't
have SCP. You can use it for basic web functionality, you can use it
(carefully) as a mechanism for testing or serving test results. I wouldn't
keep it running for days, but it's an amazingly useful tool.

~~~
verandaguy
Whoa, never thought of it that way. The makeshift SCP is really a good idea!

------
petercooper
A new one for me I accidentally found the other day..

If you use Spotlight to find something and then want to see the file in
Finder, Cmd+click the item in the Spotlight dropdown.

 _Edited from Cmd+shift+click due to note in child comment :-)_

~~~
yuxt
isn't it just Cmd+click ?

~~~
NatW
In Mavricks (only one I can be sure of) when you hover over spotlight results
and hold Cmd, you get a (quite nice) file preview/info.

------
roberthahn
oo! As long as we're sharing our favourite terminal tips, here's mine: In your
.bash_profile, add this line:

alias imgsz='sips -g pixelWidth -g pixelHeight'

sips stands for "scriptable image processing system"[1], and provides terminal
users with a toolset for inspecting and manipulating images. The alias above
is really useful for web developers who need a quick look at how big a given
image is:

    
    
        $ imgsz logo.png
        /path/to/logo.png
        pixelWidth: 500
        pixelHeight: 120
    

[1]
[https://developer.apple.com/library/mac/documentation/Darwin...](https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/sips.1.html)

~~~
aroman
thank you!

~~~
roberthahn
happy to help!

------
drcongo
Lovely, thanks. Also, is it common knowledge that CMD+click on a URL opens
that URL in your default browser? Useful for the "Running on
[http://127.0.0.1:5000/"](http://127.0.0.1:5000/") messages.

~~~
benwoodward
Nice tip, thanks. However, it only works with double-click for me.

------
scelerat
The first thing I do when setting up a new Mac is make the Caps Lock key into
another Control key.

System Preferences > Keyboard > Modifier Keys

Saves lots of awkward pinky-bending.

~~~
72deluxe
Is it me or do Mac Caps Lock keys require you to hold them down for close to a
second for them to activate? There appears to be some kind of hardware timer
in them to work...?

I noticed this coming from Windows and Linux on other keyboards where tapping
Caps Lock works but on Mac OSX with an Apple keyboard or on a Macbook you have
to make a real deliberate effort to keep the key down longer than a nanosecond
for it to register.

Is it just me who has noticed this?

~~~
chewxy
I noticed this on the lock screen. Often you'd have to tap multiple times on
caps lock before it even turns on. I assume it's to prevent accidental caps
locking, but it can be rather irritating

------
purephase
I have tried to use Terminal, but I just can't. The ability to highlight and
automatically have the text in clipboard is such a crucial feature in my
workflow that not having it even as an option is a deal breaker.

Once I started with iTerm and built a config/flow around it, I can't go back.

Thanks for the tip though! I didn't realize this worked in Terminal too. I'll
keep it in mind the next time I'm forced to use it.

~~~
actionscripted
Same here. Switched to iTerm for proper mouse support in Vim, and you need
only click (no option key) to move your cursor in Vim if you have `mouse=a` in
your vimrc.

I used to be a die-hard Terminal.app user but with Mavericks it felt
incredibly sluggish doing everything from opening to listing files to editing
things and this is another reason I moved to iTerm.

Be warned, though, that if you're using Vim with Solarized you and you're
trapped in low color mode you want to be sure you're declared as a 256 color
term and update your `vimrc` to remove the following for the colorscheme to
work properly:

Remove:

* let g:solarized_termcolors = 256

* let g:solarized_termtrans = 1

* let g:solarized_contrast = "normal"

* let g:solarized_visibility = "normal"

~~~
sd8f9iu
I added mouse support to Terminal via MouseTerm:
[https://bitheap.org/mouseterm/](https://bitheap.org/mouseterm/). Works like a
charm with Vim.

------
pilif
This works if whatever is currently running in your terminal has support for
the XTerm mouse escape sequences.

Option-click is the shortcut to tell the terminal to forward the click to the
application running in the terminal. That's usually your shell or some editor.

I seem to faintly remember that at some point this was actually configurable
and you could configure the terminal to forward non-option-clicks and only
enable selection mode on option clicks. I didn't find this option in current
iTerm or Terminal.app versions though - I might just be imagining this.

~~~
tanvach
I can confirm that this works with VIM and nano

------
rynop
Nother related tip: command + click on a file in iTerm opens it up. Test it
out by doing ls -al then cmd+click on file name.

------
ghotli
Osx terminal uses almost all of the emacs movement keys by default. Ctrl-a and
ctrl-e are useful but I find the meta movement keys to be the most helpful.
(usually alt or ESC)

Meta-f jump forward a word

Meta-b jump backwards a word

~~~
te_chris
It's not emacs, it's GNU Readline (or likely some BSD readline given apple and
the GPL)
[http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html](http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html).

The shortcuts also work in every text field in the OS.

~~~
SeanLuke
Terminal may be using some kind of Readline, I dunno. But text objects in
other OS X applications use _emacs_ keybindings because NeXTSTEP has had them
since time immemorial. Like 1990 or so. Doesn't have anything to do with GNU
Readline so far as I know.

~~~
pyre
> Terminal may be using some kind of Readline

Terminal.app passes the key sequences to the application running inside of the
terminal. The default shell (bash) uses GNU readline, which has an emacs-mode
and a vi-mode (emacs is the default).

Terminal.app does not use any Cocoa text fields, so has nothing to do with the
Emacs keybindings inherited from NeXTSTEP.

------
raju
Two more (for Bash) -

Ctrl-x, Ctrl-e will pop open your EDITOR so you can edit the command. Saving
and closing the editor brings the command back in your terminal and
automatically executes it.

fc will bring up your EDITOR with the last typed command. (You can use fc -l
to see a list of commands)

~~~
penguindev
damn.. thats the real #yearslost for me. I should have focused on learning
that instead of the wordback/forward commands.

~~~
critium
Whoa! I actually like this better than setting vi mode on terminal.

------
josho
Also useful is Apple's support doc listing of keyboard shortcuts.
[http://support.apple.com/kb/HT1343](http://support.apple.com/kb/HT1343)

------
mikeroher
Two more tips:

* Ctrl-a to go to beginning of line

* Ctrl-e to go to end of line

~~~
zampano
A couple more:

* ⌘ + ` (tilde key) to switch between different windows of your current application

* ⌘ + l (lowercase L) in most web browsers to highlight the address bar

~~~
netghost
I'm always telling people about ⌘ + `, it makes navigating windows on OSX so
easy.

------
andr
mdfind to get Spotlight results in shell.

Also, iTerm is a great Terminal replacement, if you haven't tried it.

~~~
sgt
iTerm does not support OP's tip though.

~~~
radio4fan
Does for me.

iTerm 2.0 Build 1.0.0.20140112 (latest version)

~~~
jontro
Looks like they just added support for it

------
lukabratos
Increase or decrease volume by small increments: alt + shift + volume up /
volume down or brightness up / brightness down. Also Alfred and Shortcat app.

------
SmileyKeith
I would lose years if I used the mouse in the terminal..

------
zodvik
To cut & paste files in Finder - use Cmd + C, then Cmd + Option + V.

~~~
nimeshneema
Thank you very much. Have been looking for this shortcut for eons. Made my Day
:)

------
jaredsohn
OSX also features a lot of neat trackpad multitouch commands that some might
not be aware of (my Windows trackpad doesn't understand multitouch.)

Two fingers: up/down: scroll up/down, left/right: forward/back in some
browsers (such as Chrome)

Three fingers: up/down: show/hide a list of applications/desktops; left/right:
switch desktops one at a time.

Five fingers together/apart: show/hide desktop

Before I discovered these, I was confused why I would occasionally see the
forward/back arrow in the browser for a short period of time, not realizing
that it showed because I happened to use a couple of fingers to move the mouse
cursor.

~~~
TheSoftwareGuy
[http://www.boastr.net/](http://www.boastr.net/)

you can add tons of additional trackpad shortcuts too, as well as keyboard
shortcuts.

------
thebouv
The OP tip is nice to have built-in now. If I recall correctly, this was an
option that had to be turned on in Terminal Preferences in earlier releases.

Another fave of mine: Ctrl-w for deleting whole "words" at a time. Better than
holding that delete key down.

The default shell for OS X appears to be bash (my favorite shell as a Linux
user as well).

Just google for Bash shortcuts. Here's a place to start:
[http://teohm.github.io/blog/2012/01/04/shortcuts-to-move-
fas...](http://teohm.github.io/blog/2012/01/04/shortcuts-to-move-faster-in-
bash-command-line/)

------
gargarplex
via [http://apple.stackexchange.com/questions/5435/got-any-
tips-o...](http://apple.stackexchange.com/questions/5435/got-any-tips-or-
tricks-for-terminal-in-mac-os-x)

~~~
archagon
Great link, I spent a good while digging through there when I first found it.
My favorite is using mdfind to leverage Spotlight for file search. Results
come up instantly.

------
chavesn
You can also CMD+click and drag (or double click as long as it's not a URL,
which will open) to add to the text selection (like multiple cursors in
Sublime Text 2).

Also, Option+click and drag gives you column selection mode.

------
albemuth
If you'd rather not use the mouse, the fc command will open the last-executed
command on vim (this is configurable, I suppose), saving and exiting the file
executes the command!

------
niyazpk
Works even when you are ssh-ed into a remote machine! Nice.

~~~
penguindev
yep. I tried it myself thinking it wouldn't. wow.

------
axit
Source:
[https://twitter.com/blackjack75/status/422036078540103681](https://twitter.com/blackjack75/status/422036078540103681)

More tips linked in above tweet:
[https://apple.stackexchange.com/questions/5435/got-any-
tips-...](https://apple.stackexchange.com/questions/5435/got-any-tips-or-
tricks-for-terminal-in-mac-os-x)

------
sandGorgon
So I see a lot of comments in this thread about OSX has a much cleaner
interpretation of Command-C vs Ctrl-C in Linux. Actually, the problem is that
you should NOT be using ctrl-c to copy in linux. the global copy command in
Linux obeys the CUA [1] standard. Copy is defined to be "Ctrl-Insert" and
paste is defined as "Shift-Insert". This will work on all kinds of user
interfaces on Linux - including the cmdline, the browser, etc.

However this is an issue which I dont know is a bug or something (I'm on
Ubuntu 12.04) - if you open "System Settings" in Ubuntu and copy text from
there, I'm not able to paste it on the browser, but am able to paste it
everywhere else using the command sequence described above.

[1]
[http://en.wikipedia.org/wiki/IBM_Common_User_Access](http://en.wikipedia.org/wiki/IBM_Common_User_Access)

------
tunnuz
Type "set -o vi" on your bash, and you can edit your commands with the vi
shortcuts.

------
_djo_
Works in iTerm too.

~~~
SnowLprd
Not for me. Option-clicking produces no result for me on iTerm 1.0.0.20130319.

~~~
_djo_
I tested it in iTerm 2 Build 1.0.0.20131228, where it works. It must be a
recent addition.

------
k-mcgrady
Most useful thing I've seen all day - thanks!

------
natch
I wish there was a way to make the mouse cursor stand out more when (and only
when) it's over the terminal. Maybe it's because I use a dark terminal
background, I can hardly ever see the thing.

There's a system wide setting to make the cursor huge, but I don't want a huge
cursor everywhere. And there's a terminal preference to make the insertion
cursor different, but that's a different cursor, not the mouse cursor.

When do I want to see the mouse cursor? It's useful for things like
highlighting a git hash or a few lines of text for copy/paste.

~~~
mikeswiss
in windows theres something where you can press controll and it will shoot
circles out from your mouse which is pretty useful, not sure if there is
anything like that in osx

~~~
fordh
There are a few options for cursor highlighting here:
[http://osxdaily.com/2011/07/12/3-ways-to-make-the-mac-os-
x-c...](http://osxdaily.com/2011/07/12/3-ways-to-make-the-mac-os-x-cursor-
more-visible-for-presentations/)

------
emehrkay
drag + drop files to terminal to get its location.

I often do "cd " \+ dragon drop folder to get to that folder in terminal

~~~
MaxGabriel
There's a free app called Go2Shell that adds a button to finder to open the
current directory in Terminal/iTerm. Also works great in conjunction with
"open ."

~~~
lunixbochs
You can drag/drop many things onto an application icon in the dock to open
them in a new window.

This includes dragging a folder's proxy icon to the terminal app to open the
current Finder window in a new terminal.

The proxy icon is the little icon in the top middle of the window, to the left
of the name.

------
javajosh
Off-topic, but related: does anyone know a way to bind a key, and F-key for
example, to a particular application in OSX? The behavior I'm looking for is
almost achievable with Spaces - but it's basically when you hit the combo from
anywhere, the target application comes to the foreground, or if it's not
running, it launches.

Command-Tab is fine and dandy, but I want more _stability_ in my application
switching. And if it doesn't exist, I may have to dust off XCode like I've
been threatening to do for a while now.

------
etoulas
As it wasn't mentioned yet: _pushd / popd_

These two commands replace 'cd' and work with a directory stack of different
paths.

    
    
       $ pushd tmp   # cd to tmp and remember current path /
       /tmp /
       $ pwd
       /tmp
       $ cd /usr   # normal cd to wherever you want...
       $ pwd
       /usr
       $ popd   # pop the stck and get back to the previous path
       /
       $ pwd
       /
    

Subsequent pushd will stack multiple paths.

It's a built-in of bash and other shells. It works even with Windows' cmd.exe

~~~
nightwolf
You can also use "cd -" to go back to the previous path:

    
    
      $ cd /
      $ pwd
      /
      $ cd /tmp
      $ pwd
      /tmp
      $ cd -
      $ pwd
      /
    

Not the same, of course, but still useful, I think.

------
mcella
Great Tip!

Regarding OSX Terminal, I'm an heavy user since Leopard but it's a shame that
after upgrading to Mountain Lion (an now Mavericks) I discovered that they
broke VIM vertical selection since control-shift does not generate a keycode
anymore [1].

Anyone with the same problem? I tried iTerm recently and I don't like it! :-(

[1]
[https://discussions.apple.com/thread/4694342?start=0&tstart=...](https://discussions.apple.com/thread/4694342?start=0&tstart=0)

------
coherentpony
Wait, people use the mouse when they're in the terminal?

~~~
Angostura
They do now.

------
FlyingAvatar
I've always preferred, option + left/right for fast moving with left/right for
fine adjustment so I don't have to leave the keyboard.

------
pfortuny
Well, if you do not want to use the mouse, you can always:

Ctrl-e: go to the end of the line Ctrl-r: search backwards (input the text)

and you go to the point where the search begins.

------
donskif
Great tip, thanks.

Another useful fyi that I haven't seen anybody else mention is the Bash
framework bash-it [[https://github.com/revans/bash-
it/](https://github.com/revans/bash-it/)]. It has tons of fantastic plugins,
aliases and themes out of the box.

I've only tried it on iTerm2, but as it only replaces your .bash_profile file
it should work fine on Terminal.

------
caiob
The problem here is the "click" part of it.

~~~
blktiger
Every once in a while it's much faster to just reach for the mouse than to use
keyboard shortcuts.

------
yogsototh
OK, so for vim users with zsh:

bindkey -v

Now be happy, hit <ESC> and, use ^ and $ but also f<letter> t<letter> and also
,;.

You can copy/paste with dd, Y, etc...

~~~
coliveira
set -o vi does the trick for vim. Most vi commands work, but when you type
<ESC>v this will open vi to edit your command line, in case you feel any
command is missing.

~~~
GrinningFool
I've b een using vi-mode in the shell for a while,but haven't been able to get
the <ESC>v behavior you described. Did you have to do anything to make that
behave?

~~~
coliveira
I haven't done anything, my version works under Mac OS X.

------
IgorPartola
Doesn't work on iTerm2, which y'all should be using anyways. Besides being
infinitely more configurable, and getting tabs right, it's also much faster
when you are printing a bunch of text. No idea why OS X Terminal is so slow
when it comes to this, but it's actually painful to `cat` a file of more than
a thousand lines.

~~~
ebzlo
I don't cat files too often in my workflow so I guess I don't have that pain
point, but I find find iTerm2 has this minor annoying latency (kind of like
typing on a wireless keyboard on low battery) that ultimately drove me away
from it.

~~~
IgorPartola
Odd. I have never experienced that problem. I don't cat files, but I list git
diff output, view log files, etc. Even a large-ish git blame introduces a
noticeable lag.

------
makecheck
In MacTerm, command+option+click will move the terminal cursor in the same way
by simulating keys. It also moves “up” or “down”, for applications such as
text editors that understand vertical arrows. There is even a preference
setting that attempts to move the cursor automatically to wherever you drag
and drop text with the mouse.

(Note: I wrote MacTerm.)

------
kozikow
I compiled my list of mac keyboard shortcuts and keyboard tricks:
[http://kozikow.wordpress.com/2013/10/31/going-mouseless-
on-m...](http://kozikow.wordpress.com/2013/10/31/going-mouseless-on-mac/) .
Mac is the only non text based OS that you can control with 100% keyboard.

------
fiveisprime
Another useful tip is, in iTerm, map option+left and option+right to send
escape sequence ^[b and ^[f respectively. :)

------
benwerd
That was the least obvious thing ever, and you've just measurably improved my
development experience. Thank you.

------
apinstein
And if you use vim in the terminal, you can even use the mouse to select
text...
[https://github.com/apinstein/dotfiles/blob/master/vimrc#L150...](https://github.com/apinstein/dotfiles/blob/master/vimrc#L150-L164)

------
eswat
If you want to invoke a command in the menubar quickly - such as applying
filters in Photoshop - hit Cmd + Shift + ?. Thill will bring up the Help
Search menu and you can type the name of the menu item you want to invoke.
Then just hit Enter and it’s done!

------
brbcoding
Whoa, it would seem that you can option click above the line and go back in
history!

------
Phr34Ck
[http://apple.stackexchange.com/questions/5435/got-any-
tips-o...](http://apple.stackexchange.com/questions/5435/got-any-tips-or-
tricks-for-terminal-in-mac-os-x/5502#5502)

------
lukasm
another tip. Using mdfind you can do what find does but using Spotlight index

------
e28eta
I like checking the box in preferences to use Option as Meta, and then option
+ left/right will jump a word at a time, and option + backspace will delete
the previous word, just like in most Cocoa apps.

------
thucydides
Move cursor left or right word-by-word: alt + left arrow, alt + right arrow

------
zytek
If you use mouse to move around your Terminal, you're doing it wrong.

------
lloeki
Go to Keyboard Shortcuts in System Preferences and remap "Send reset" to
cmd+ctrl+R or something, because it saves sanity when going back and forth
between vi in a term and a browser.

------
SDMattG
This is amazing. You have saved me countless seconds of frustration :-)

~~~
kineticfocus
Maybe even more than that...lol... (Andy Hertzfeld & Steve Jobs Re: boot
times)
[http://www.folklore.org/StoryView.py?story=Saving_Lives.txt](http://www.folklore.org/StoryView.py?story=Saving_Lives.txt)

------
xmodem
This. changes. everything.

~~~
72deluxe
sentences. seem. really. short. recently. but. I. don't. know. why. as. it.
makes. the. text. impossible. to. read. and. also. makes. you. sound. like.
you're. in. the. slow. readers. group.

------
phronmophobic
I've found that maxing out the key repeat rate makes life better. System
Preferences > Keyboard. Select the keyboard tab then move the Key Repeat
slider all the way to the right.

------
lobster_johnson
Or you could set up your .inputrc to make arrow keys (eg., ctrl+arrow to jump
between words) work properly. It also helps to learn the other Readline
shortcuts (ctrl-A for home, etc.).

------
jheriko
another one, you can drag files and folders onto the terminal and it will
paste the path in at the cursor position... very useful to cd to some path you
have open in Finder

------
adriaanm
The search clipboard: cmd-e is to cmd-g as cmd-c is to cmd-v.

------
mkeiser
I never understood the rationale of this behavior (not being able to just
click anywhere to set the curser position). At least in not-yet-executed
input.

------
michaelhoffman
Is there a way to do something similar in Linux? I use gnome-terminal but
would think about switching to something with a feature this useful.

~~~
virtualwhys
Same deal, Gnome terminal, alt-b, alt-f are the closest I've found.

------
sazeod
Or you can use vim editing mode directly in bash using:

set -o vi

this makes most vim motions available at the command line after hitting "esc"

------
jbarham
20 years ago with Plan 9 you could have just clicked to move your cursor.
_Plus ça change_...

------
nocivus
No one uses Terminal. iTerm ftw ;)

~~~
Kiro
I use iTerm as well but besides from splitting panes and broadcasting I don't
see the benefits. Why do you use it?

~~~
rsynnott
Terminal.app wasn't very good back in the day; I think a lot of people ended
up on it because of that and never went back. Also, CMD-click is far nicer for
opening links than CMD-doubleclick :)

------
vincentwang
in .inputrc, I enable vi mode, and borrow some handful emacs keybindings(c-a
beginning-of-line, c-e end-of-line, c-k kill-line etc) under vi insert mode,
so I can get benefits from both worlds, just like what I did under vim :)

------
macinjosh
Tip: Real hackers don't use a mouse.

/s

~~~
Refefer
Perhaps it's simply personal preference, but I do find that limiting my mouse
usage has resulted in real, tangible gains. I don't know how feasible that is
in GUI-first operating systems like OS X, though.

~~~
lunixbochs
Check out Alfred 2, Shortcat, Slate
([https://github.com/lunixbochs/reslate](https://github.com/lunixbochs/reslate)).
You don't need the mouse as much as you might think.

------
redeemedfadi
<Ctrl> X, <Ctrl> E to edit the current line in your default editor.

------
dsego
You can type say "hello" and the terminal will greet you.

------
leonvonblut
hashtags on hacker news... please let me die. Nice tip!

------
nailer
FYI this is 'Alt' on modern Mac keyboards.

------
niuzeta
yearslostcounter++;

------
grillermo
Works on iTerm too!

------
weddpros
sips -Z 1280 file.jpg to resize a photo easily...

------
davidedicillo
If we'll ever meet, beer is on me. Thanks!

------
thearn4
Simple, to-the-point, and very useful. Thanks!

------
scottyallen
This appears to work in iTerm2 as well. Neat!

------
khalidmbajwa
Nothing will ever be the same again #HolyWow

------
beshrkayali
Sucks that it doesn't work in iTerm2.

~~~
jimhart3000
For some reason when I try this in iTerm2, it jumps to a different command in
my history. No idea what's going on there...

~~~
gnachman
Terminal does the same (for me). It's because opt-clicking above the line
sends some up arrow keystrokes, which the shell interprets as moving back in
history. In iTerm2 nightly builds (which are less stable than the betas) you
can disable opt-click to move the cursor in prefs>profiles>pointer.

What's more interesting is the possibility of using the new shell integration
features
([https://code.google.com/p/iterm2/wiki/ShellIntegration](https://code.google.com/p/iterm2/wiki/ShellIntegration))
to turn off this feature just at the shell prompt. I'll open a feature request
for that :)

------
Fishrock123
... Why didn't I know this before?

Thanks for sharing!

------
bingeboy
Come on kid! set -o vi == life saved

------
adsrikanth
What do you mean by hold option?

~~~
72deluxe
Confusingly, the alt key that has had the word 'opt' put on it on some Apple
keyboards and not on others...

[http://en.wikipedia.org/wiki/Option_key](http://en.wikipedia.org/wiki/Option_key)

------
dustinbrownman
Holy guacamole! #lifechanged

------
dnyce
Wow. Talk about #yearslost!

------
seanhandley
This just made my day <3

------
giuliano108
cmd option mouse-drag: blockwise selection

------
whyme
thank you; you just made my year!

------
rajacombinator
#thankyousir

------
desireco42
Thank you :)

------
mariusbutuc
oops, not working in iTerm2...

------
dustinbrownman
holy guacamole! #lifechanged

------
jlink
Thanks !

------
LeicaLatte
you mean with a mouse?

No.

------
sweetp
holy shit.... thanks!

------
WhiteFoxx
oh my god thank you!

------
padmanabhan01
years lost indeed..

------
mahadazad
thanks for the tip

------
laza
cool, thanks

------
pketh
Mind. Blown.

------
jackmaney
Nice!

------
simonhamp
You, sir, are a genius!

------
jhwhite
I did not know this. Thanks! Very helpful tip.

