Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OS X Terminal shortcut: Jump to beginning/end of line

People also ask

How do I skip to the beginning of a line in terminal?

CTRL-A / HOME : Move to the beginning of a line.

How do you go to the end of the line on a Mac?

Control+A: Move to the beginning of the line (more here: How to find End and Home on a Mac keyboard) Control+E: Move to the end of a line or paragraph. Control+F: Move forward one character. Control+B: Move backward one character.

How do you skip to the end of line in VS code Mac?

To move from beginning to end of the file It is the quickest way to get or drag your cursor to the first or last line of the file by using the VScode shortcut. For mac: Control+Home to go to home and Control+End to go to the end. For Windows: Ctrl+home to go to home and Ctrl+End to go to the end.

How do you shift to the end of a line?

Moving the CursorEnd – Move cursor to end of current line. Ctrl+Home – Move cursor to top of the text entry field. Ctrl+End – Move cursor to bottom of the text entry field.


fn + shift + leftArrow = goto beginning of line
fn + shift + rightArrow = goto end of line

these work for me


In the latest Mac OS You can use shift + home or shift + end


I use a handy app called Karabiner to do this, and many other things. It's free and open source.

It's a keyboard remapper, with a lot of handy presets for many common remaps that people may want to do.

As you can see from the screenshot, this remap is included as a preset in Karabiner.

Screenshot of Karabiner preferences showing the preset to map cmd+left/right to ctrl+a/e

Hope this helps. Happy remapping!


As setup in the terminal using vi:

The Home button on a Macbook Pro keyboard: Fn + Left Arrow.

The End button on a Macbook Pro keyboard: Fn + Right Arrow.


Here I found a tweak for this, without any third party tool. This will make the following shortcut to work:

 fn + right: to go to the end of the line.
 fn + left: to go to the beginning of the line.
  • Open terminal preferences.(cmd + ,).
  • Go to your selected theme and then to the keyboard tab.

enter image description here

  • And add a new entry as following. enter image description here enter image description here

  • That's all. Now close and check.

    Hope it helps.

EDIT: Refer to the comment by @Maurice Gilden below for more insights.


For iterm2:

Go to Profiles / Open Profiles / Keys

Set Cmd + left_arrow_key to Send Hex Code 001

Set Cmd + right_arrow_key to Send Hex Code 005

This allows you to use Cmd + arrow_keys to move from beginning to end of the line.


I am not sure if this will work for you (I still use OS 10.8), but these work for my terminal:

home = move cursor to the start of the line
shift+end = move cursor to the end of the line

alt+leftArrow = move one "word" to the left
alt+rightArrow = move one "word" to the right

Hope this helps!