Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Move the Terminal cursor position with the mouse UNIX
Which Terminal gurus among us hasn't wasted too many minutes to count arrowing around the manipulate the cursor while deep within the confines of the command line?

The Terminal gurus who know this trick, I guess: Hold down the Option key and click where you'd like the cursor to move, and Terminal rushes the cursor that precise spot.
    •    
  • Currently 4.25 / 5
  You rated: 4 / 5 (20 votes cast)
 
[10,096 views]  

Move the Terminal cursor position with the mouse | 18 comments | Create New Account
Click here to return to the 'Move the Terminal cursor position with the mouse' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Move the Terminal cursor position with the mouse
Authored by: alexiskai on Jan 15, '14 07:45:08AM

This does seem to work inside vi, which makes it much nicer than if it only worked in the shell.



[ Reply to This | # ]
Move the Terminal cursor position with the mouse
Authored by: awado on Jan 15, '14 10:10:47AM

But it works with nano (OS X 10.8.5)! Nice. And clicking anywhere above the prompt will navigate in the command line buffer. Seems somehow not very handy, because it depends on the distance to the prompt where it gets you.



[ Reply to This | # ]
Move the Terminal cursor position with the mouse
Authored by: Makosuke on Jan 15, '14 12:17:11PM

Holy moly is that useful!

I've been using the terminal since the public beta, and I have never once seen that trick mentioned anywhere. It's certainly not documented that I can find.



[ Reply to This | # ]
Move the Terminal cursor position with the mouse
Authored by: slb on Jan 15, '14 12:31:29PM

Killer hint! I know "true code jockeys" will frown, but I love it!



[ Reply to This | # ]
Move the Terminal cursor position with the mouse
Authored by: nova20 on Jan 16, '14 05:36:21AM

Wow! Years of cursing the terminal. This should have been the first item in any terminal help file.



[ Reply to This | # ]
Move the Terminal cursor position with the mouse
Authored by: FJModrego on Jan 17, '14 04:38:22AM

After eons using the terminal and the vi editor, this is the most useful and simple tip ever !!!



[ Reply to This | # ]
Move the Terminal cursor position with the mouse
Authored by: keirthomas on Jan 17, '14 06:57:11AM

If you think this is good, these might just blow your mind:

http://www.mackungfu.org/3-lesser-known-terminal-tricks

---
Author of Mac Kung Fu
Over 400 tips, tricks, hints and hacks for OS X
My tips blog: http://mackungfu.org
Edited on Jan 17, '14 06:58:02AM by keirthomas


[ Reply to This | # ]
Move the Terminal cursor position with the mouse
Authored by: awado on Jan 17, '14 11:51:09AM

In addition to a tip mentioned there: "To reuse text you’ve already typed ..., just highlight it using the mouse then hit Shift+Command+V — no need to copy it first to the clipboard."

You can also just drag the highlighted text a few pixels, without pressing any key. It will be inserted at the prompt position. This drag&drop also works across applications. For example, when there is a PDF or a web page containing some code, you only have to highlight the code and drag it onto the terminal window. Even works with newline for RETURN.



[ Reply to This | # ]
Move the Terminal cursor position with the mouse
Authored by: jazzbri on Jan 17, '14 08:29:51AM

Holy cow, how did I not know this? I whipped up a Keyboard Maestro that will automatically insert the cursor when you click inside the Terminal... no need to push 'option' this way. You can find the macro here if you're interested:

https://www.dropbox.com/s/r8hie808kfxyzyj/Insert%20Cursor%20at%20Clicked%20Position.kmmacros

Just make sure to only set the macro to allow it only to run in Terminal :-)



[ Reply to This | # ]
Move the Terminal cursor position with the mouse
Authored by: pullinst on Jan 22, '14 08:26:43AM

One hint every now and then ... this site has really gone downhill.



[ Reply to This | # ]
Move the Terminal cursor position with the mouse
Authored by: pullinst on Jan 23, '14 09:01:23AM

Eight days without a new hint ... seriously?

I guess it's about time to find a better site to read ... this one is dead it seems.



[ Reply to This | # ]
Move the Terminal cursor position with the mouse
Authored by: rv8 on Jan 27, '14 01:51:49AM

Most of the hints come from user submissions. How many hints have you submitted in the last eight days?

---
Kevin Horton



[ Reply to This | # ]
Move the Terminal cursor position with the mouse
Authored by: keirthomas on Jan 25, '14 06:51:34AM

To be fair all the Macworld guys were working hard this week for the big event yesterday -- the 30th birthday of the Mac.

Even so, if Macworld is serious about this site it should have a dedicated editor. I'm not sure if Crarko was paid for the stint he used to do but I doubt anybody's going to do a good job unless they're paid for it.

---
Author of Mac Kung Fu
Over 400 tips, tricks, hints and hacks for OS X
My tips blog: http://mackungfu.org



[ Reply to This | # ]
Move the Terminal cursor position with the mouse
Authored by: baltwo on Jan 29, '14 12:57:13PM

Then, there are these:

Ctrl + A Go to the beginning of the line you are currently typing on
Ctrl + E Go to the end of the line you are currently typing on
Ctrl + L Clears the Screen, similar to the clear command
Ctrl + U Clears the line before the cursor position. If you are at the end of the line, clears the entire line.
Ctrl + H Same as backspace
Ctrl + R Letís you search through previously used commands
Ctrl + C Kill whatever you are running
Ctrl + D Exit the current shell
Ctrl + Z Puts whatever you are running into a suspended background process. fg restores it.
Ctrl + W Delete the word before the cursor
Ctrl + K Clear the line after the cursor
Ctrl + T Swap the last two characters before the cursor
Esc + T Swap the last two words before the cursor
Alt + F Move cursor forward one word on the current line
Alt + B Move cursor backward one word on the current line
Tab Auto-complete files and folder names



[ Reply to This | # ]
Move the Terminal cursor position with the mouse
Authored by: robleach on Jan 30, '14 09:37:10AM

I assume these must be shell-specific, because in tcsh, I note these differences:

^w - Clears the line before the cursor position. If you are at the end of the line, clears the entire line.
^d - End of input character (e.g. use if running something like `cat > file`)
option-left-arrow - Move cursor backward one word on the current line
option-right-arrow - Move cursor forward one word on the current line
(option-f & option-b insert special characters)

I tried these in bash and also note some differences:

option-left-arrow - Move cursor backward one word on the current line
option-right-arrow - Move cursor forward one word on the current line
(option-f & option-b insert special characters)
^d - deletes characters forward

Rob



[ Reply to This | # ]
Move the Terminal cursor position with the mouse
Authored by: keirthomas on Jan 31, '14 12:21:09AM

Yeah, those shortcuts he gave are pretty much BASH/emacs. People can just look-up those online if they want clues as to shortcuts (or just look in the man pages), and they're not OS X-specific, obviously.

---
Author of Mac Kung Fu
Over 400 tips, tricks, hints and hacks for OS X
My tips blog: http://mackungfu.org



[ Reply to This | # ]
Move the Terminal cursor position with the mouse
Authored by: robleach on Jan 31, '14 06:52:15AM

I know there are more hints available to post, since I submitted one. Where are you guys? Tell us what's going on. Is somebody sick?



[ Reply to This | # ]
Move the Terminal cursor position with the mouse
Authored by: pullinst on Jan 31, '14 10:55:53AM

It feels like they've decided to limit the site to one new hint per month.



[ Reply to This | # ]