Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I used iTerm for some time and switched now back to the Terminal.app again. One nice feature about iTerm is that double clicking on text does not select the word under the cursor, but rather the pathname.

I miss this feature and I googled a bit to find out if/how I can select pathnames (without selecting it by hand) in Terminal.app. The only tip I found was Terminal.app: Selecting Pathnames. This suggests to use holding the option key while double clicking. Unfortunately, this does not work for me (on Snow Leopard).

So how do I select pathnames instead of words in Terminal.app on Snow Leopard?

share|improve this question
    
Holding down option changes the mouse selection method from character-based to column-based... –  Arjan Sep 22 '09 at 10:47
    
Yes, according to macosxhints.com/article.php?story=20071102073946354 the behavior has changed in Leopard. –  ashcatch Sep 22 '09 at 12:58

3 Answers 3

up vote 7 down vote accepted

After some more googling I finally found the answer to my own question: in Leopard and Snow Leopard, you have to Command+Shift+Double Click. This has the following behaviour:

  • If the text at the mouse position is an URL, open it.
  • Otherwise select it as an pathname

See also Apple Discussions and Mac OS X Hints.

share|improve this answer
    
For those who read as badly as I do: it's not just an additional Shift, but also Command rather than Option... –  Arjan Sep 22 '09 at 22:20
    
+1: works for me. –  Josh Sep 23 '09 at 0:42

Not a direct answer to your question as it's already been answered, but I'm betting you're selecting a path so that you can copy it and paste it somewhere else. There are a couple of commands/keystrokes that are worth knowing about so you can avoid touching your mouse (and slowing things down in the terminal).

The first is the "pbcopy" command. Anything piped to it will be put in your clipboard, so if you want to have the current working directory in your clipboard, you can use:

pwd | pbcopy

I've got this aliased to cpwd in my zshrc:

alias cpwd='pwd | pbcopy'

Another is that I often want the last argument to the last command so that I can do something with it again, pressing "opt-." (or esc-. if you haven't selected preferences->keyboard->use option as meta key) will automatically put the last arg for the previous command at the cursor location.

I use this all the time to operate on a file/directory, so if I just moved a file somewhere else, I can edit it like this:

mv /usr/local/foo /Users/tnaleid/bar

Typing "vi " and then hitting opt-. will put this on my command line so I can execute or edit to taste:

vi /Users/tnaleid/bar
share|improve this answer
    
I wanted to vote -1, because this really has absolutely nothing to do with his question. But pbcopy is a great utility and this is otherwise a very helpful post I would normally vote +1, so I took no action... –  Josh Sep 23 '09 at 0:44
    
yeah, I'm totally guessing at the OPs reason for wanting to select pathnames and I thought that many people who did a search on something like this might actually be wanting to do some of the stuff I have in my answer. Since there's already a great answer about how to do what the OP wanted, I didn't think it'd hurt to add this (thanks for not down voting :). –  Ted Naleid Sep 23 '09 at 16:16

Last argument of the last command is !$

mv xyz /a/b/pqr

vi !$
share|improve this answer
1  
Didn't answer the question. –  livibetter Nov 21 '12 at 3:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.