Sunday 11 September 2011

Moving the cursor on the command line

Bash shortcuts source


Ctrl + a – go to the start of the command line
Ctrl + e – go to the end of the command line
Ctrl + k – delete from cursor to the end of the command line
Ctrl + u – delete from cursor to the start of the command line
Ctrl + w – delete from cursor to start of word (i.e. delete backwards one word)
Ctrl + y – paste word or text that was cut using one of the deletion shortcuts (such as the one above) after the cursor
Ctrl + xx – move between start of command line and current cursor position (and back again)

Ctrl + r – search the history backwards


and dont forget good old ^^. ^x^y = run last command but replace 'x' with 'y'

6 comments:

  1. fc - load last command in Vim - allowing you to edit it and then rerun it.

    ReplyDelete
  2. bind '"\e[A": history-search-backward'
    bind '"\e[B": history-search-forward'

    /\ changes up and down to search thru your shell history

    ReplyDelete
  3. Reddit link
    http://www.reddit.com/r/linux/comments/mi80x/give_me_that_one_command_you_wish_you_knew_years/

    ReplyDelete
  4. ESC - b and ESC - f to move cursor forward/backward by word

    ReplyDelete
  5. ALT-. (dot key) - walk back thru list of previous aguments.

    ALT-NUMBER CTRL-ALT-Y - duplicate the NUMBER param (0 is the command)

    ReplyDelete
    Replies
    1. !:NUMBER - duplicate the NUMBER param (0 is the command)

      Delete