New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Operating System General OS operation information and support

keyboard shortcuts for command line navigation in the terminal


Post Reply New Thread Subscribe

 
Thread Tools
steviep

 
Member Since: Apr 03, 2011
Posts: 10
steviep is on a distinguished road

steviep is offline
Hi all,
I am a relatively new user to the mac OS (migrating from Ubuntu), and I am still learning the numerous useful keyboard shortcuts.

I use the terminal a lot. One thing that is driving me crazy is how to move the cursor around on the command line.
Besides the arrow keys, here is what I've learned:
[ctrl]-a (takes you to the beginning of the line)
[ctrl]-e (takes you to the end of the line)

[alt]- (left arrow) or (right arrow) does *not* work to move back by 1 word, as it does for example in this editor window as I type.

To move back or forward by 1 word, I found I have to type:
[esc]-b or [esc]-f
and I have to retype [esc]-b *each time* I move back by 1 word, rather than just holding down the [esc] key and arrowing along by a word at a time.

This seems like such a trivial point, but it can drive a command line user crazy. Is there some simpler way to move around by a word (or more) at a time on the command line? If there is no default way, can a keyboard sequence be set to do this?

Thanks,

steviep
QUOTE Thanks
steviep

 
Member Since: Apr 03, 2011
Posts: 10
steviep is on a distinguished road

steviep is offline
Further to my post, I forgot to mention that
[ctrl]-w deletes the previous word, which is very useful.
However, I don't know how to forward-delete the next word... its not
[ctrl]-(delete) , [alt]-w , or [ctrl]-[shift]-w
Anybody know?
QUOTE Thanks
TattooedMac

 
TattooedMac's Avatar
 
Member Since: May 19, 2009
Location: Waiting for a mate . . .
Posts: 7,727
TattooedMac has a brilliant futureTattooedMac has a brilliant futureTattooedMac has a brilliant futureTattooedMac has a brilliant futureTattooedMac has a brilliant futureTattooedMac has a brilliant futureTattooedMac has a brilliant futureTattooedMac has a brilliant futureTattooedMac has a brilliant futureTattooedMac has a brilliant futureTattooedMac has a brilliant future
Mac Specs: 21" iMac 2.9Ghz 10.9.4 13"MBP 2.9Ghz i7 Yosemite 10.10 ~ iPhone5 iOS 8 ~ iPad Mini iOS 8 ~ ATV3 6.1

TattooedMac is offline
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 + 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

Just a few for you

HTH

CogFrog Studio's ~ Photography, Apps and Web Development
Dont forget to use the Reputation System if someone has helped you out !!!
Arguing with a zealot is only slightly easier than tunneling through a mountain with your forehead!!!!!
QUOTE Thanks
steviep

 
Member Since: Apr 03, 2011
Posts: 10
steviep is on a distinguished road

steviep is offline
Thanks for the commands Tat, [ctrl]-r is a great one that I didn't know about, and so is [esc]-t

My problem is that on my MacBook Pro, the two commands:

Quote:
Alt + F Move cursor forward one word on the current line
Alt + B Move cursor backward one word on the current line
don't work. On my computer Alt+b gives a little integral sign (like a skinny script S), and Alt+f gives a "forte" sign, like in loud music.

To move back or forward by 1 word, I found that for some reason I have to type:
[esc]-b or [esc]-f
and I have to retype [esc]-b *each time* I move back by 1 word, rather than just holding down the [esc] key and arrowing along by a word at a time. It's just too awkward.

Is there some simpler way to move around by a word at a time on the command line? Or if there is no default way, can I set the keyboard sequence such as [alt]+b, [alt]+f to do this?

steviep
QUOTE Thanks
steviep

 
Member Since: Apr 03, 2011
Posts: 10
steviep is on a distinguished road

steviep is offline
To answer my own questions, some time ago a colleague fixed the problem using the following (this is my recollection):
From a terminal, go to the menu Terminal -> Preferences -> Settings -> Keyboard
and make sure the box titled "Use option as meta key" is checked.
Then [alt]-f and [alt]-b will go forward or backward one word at a time.
As well, [alt]-d and [alt]-(delete) forward or backward deletes one word at a time.

steviep
QUOTE Thanks

Post Reply New Thread Subscribe


« Can I switch off journalling on a journalled volume? | mac computer freezing »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
New mac wireless keyboard shortcuts wrong/strange yetiman Other Hardware and Peripherals 0 10-03-2010 02:02 PM
Keyboard Shortcuts variouspixels OS X - Operating System 7 03-28-2009 05:21 PM
iChat, Toggle through windows using Keyboard Shortcuts? AhmadHasib OS X - Apps and Games 2 02-21-2008 04:32 AM
Help w/ Basic Keyboard Shortcuts randalgilliam Switcher Hangout 3 07-24-2007 05:49 PM
MacDevCenter: launching AppleScripts using keyboard shortcuts MacHeadCase OS X - Apps and Games 2 06-08-2007 05:19 PM

All times are GMT -4. The time now is 11:30 AM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?