3

I often mistype a command. So I will type this

sublimetext myfile.txt 

instead of

git add myfile.txt 

When I do this, I hit up to restore the last command. But after doing so, my cursor is at the end of the previously typed line. Is there a keyboard short cut to jump back to the prompt?

3
  • You can also just type git add, then press Esc,. - it will type myfile.txt (the last argument of previous command) automatically. Commented Dec 6, 2013 at 0:47
  • @Vi. Thanks. It is a bit hard to read your comment. I should type "git add" then press the esc key, then press the comma key, then press period key? Commented Dec 6, 2013 at 0:52
  • Escape key, then period key. Without comma. There's more Esc-Something shortcuts actually. You can also use Alt+Period. See also: stackoverflow.com/questions/211378/hidden-features-of-bash Commented Dec 6, 2013 at 1:00

2 Answers 2

7

On bash command line, I use ctrl+a to go to the beginning of command and ctrl+e to go to the end of command.

0
4

After you press Up to recall the previous line, press Home to go to the beginning of the line.

1
  • 1
    Gilles, you just spoiled my kinda-troll attempt. Commented Dec 6, 2013 at 12:33

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.