Bash Shortcuts

From RVM Wiki
Revision as of 13:57, 20 May 2006 by Gabriele.vivinetto (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Basics

  • Use up and down arrows to recall previous command
  • Use right and left arrows to make changes in current command line
  • After one or more letters of a command or filename, hit the Tab key for command or filename complete; if this is non-unique, hit the Tab key a second time for possible choices.
  • !gcc will repeat the previous command starting with 'gcc'
  • 'gvim !$' will apply the command 'gvim' to the last argument on the previous command line (in Unix, '$' is a symbol for last row, column or argument depending on the context)


Other useful methods for editing command line

Includes the command line for interactive command based programs such as Splus [in emacs edit mode], R, maple, octave, mysql etc]

Most of these are the same as editing in emacs, so you can check the emacs on-line help for other quick-edit possibilities.

The editing is based on the ctrl-key in combination with another key (usually a meaningful letter for a-z) or the esc-key followed by another key (from a-z)

Ctrl keys

  • ctrl-a: beginning of line
  • ctrl-e: end of line
  • ctrl-k: delete (kill) remainder of line
  • ctrl-u: delete entire command line
  • ctrl-w: delete previous word
  • ctrl-t: transpose 2 characters
  • ctrl-y: yank or recover previous deletion
  • ctrl-d: delete character at cursor; note distinction from the backspace key or ctrl-h: delete character before cursor
  • ctrl-f: forward one character (needed in 'emacs/Splus -e' because arrows keys don't work)
  • ctrl-b: backward one character (same comment as above)

Esc combinations

  • esc-d: delete word
  • esc-f: forward a word
  • esc-b: backward a word
  • esc-t: transpose two adjacent words

Note that some of the Ctrl-key combinations like ctrl-a, ctrl-e, ctrl-k, ctrl-u also may work in entry fields in X applications (an example is the web Location entry box in the netscape browser.

Riferimenti