Question 7 which bash shortcut or command jumps to the beginning of the command line?
Improve Article Show
Save Article Improve Article Save Article In this article, we will learn how to move to the start and end of a command. We will demonstrate the key combinations in a Git terminal. The same key combinations work in other Unix style terminals too. Moving to the Starting of the CommandCtrl + A : The ‘Ctrl+A’ key combination moves the pointer to the start of the command. In the below gif image, you can see how pressing the ‘ctrl+A‘ combination after typing the command ‘touch index.html‘ moved the pointer to the start. Moving to the Ending of the CommandCtrl + E : The ‘Ctrl+E’ key combination moves the pointer to the end of the command. In the below gif image, you can see how pressing the ‘ctrl+E’ combination moves the pointer to the end i.e., at the end of ‘touch app.js‘. There are two sides to the question, the technical side and the historical side. The technical answer is because
where Some of the above bindings are added by default, others I have added (via (Please note, this endeavours to summarise many years of history from many decades ago, and glosses over some details.) Now, why is it Control-a in particular? Readline uses by default Emacs-like bindings. Control-a in GNU Emacs invokes Stallman and Steel's original EMACS was inspired by Fred Wright's E editor (an early WYSIWYG editor) and TECO (a cryptic modal editor/language) -- EMACS was a set of macros for TECO. See Essential E [PDF] (from SAIL, 1980). E however used Control-Form for "beginning of line", this was on the "DataDisc" keyboard which had a Control key, and a Form key. The space-cadet keyboard of the time (lacking a Home key by the way, though it had an End) is commonly blamed for the Emacs keyboard interface. One of the desirable features of EMACS was its use of TECO's Control-R "real-time" line editing mode (TECO predates CRT/keyboard terminals), you can see the key bindings on page 6 of the MIT AI Lab 1978 ITS Introduction to the EMACS editor [scanned PDF], where ┌ is used to denote Control. In this mode, the key bindings were all control sequences, largely mnemonic: Control-E End of this line, Control-P move to previous line, Control-N move to next line, Control-B backward one character, and not least Control-A move to beginning of this line, Costas' suggestion of "first letter of the alphabet" for this is as good as any. (A similar key-binding is in the The Control-A/Control-E bindings in "^R mode" were implemented directly in the ITS TECO (1983, version 1208, see the To recap:
See also:
Which bash shortcut or command jumps to the beginning of the command line?These shortcuts will help: Ctrl + E - go to the end of the line. Ctrl + A - go to the start of the line. Alt + left - go back one word.
Which bash shortcut or command copies the last argument of previous commands?I often use the Bash command yank-last-arg , shortcut M-. or Esc + . . This copies the last argument from the previous history entry into the current line at the current position, so you can check and edit the argument.
Which bash shortcut for command displays the list of previous commands?The following shortcuts are used for searching for commands in the bash history:. Up arrow key – retrieves the previous command. ... . Ctrl+P and Ctrl+N – alternatives for the Up and Down arrow keys, respectively.. Which bash shortcut or command is used to clear characters from the cursor to the end of the command line?Ctrl + A Ctrl + K - move the cursor at the beginning of the line and clear all the current line from the beginning to the end.
|