keyboard shortcuts for command line edit
As you edit a command line, at any point you can type regular characters to add those characters to the command line. The characters appear at the location of your text cursor. You can use right A and left ¨ arrows to move the cursor from one end to the other on the command line. You can also press the up ↑ and down ↓ arrow keys to step through previous commands in the history list to select a command line for editing.
There are many keystrokes you can use to edit your command lines. Below are the lists of keystrokes that you can use to move around the command line.
Keystrokes for Navigating Command Lines
Keystroke Full Name Meaning Ctrl+F Character forward Go forward one character. Ctrl+B Character backward Go backward one character. Alt+F Word forward Go forward one word. Alt+B Word backward Go backward one word. Ctrl+A Beginning of line Go to the beginning of the current line. Ctrl+E End of line Go to the end of the line. Ctrl+L Clear screen Clear screen and leave line at the top of the screen.
Keystrokes for Editing Command Lines
Keystroke Full Name Meaning Ctrl+D Delete current Delete the current character. Backspace Delete previous Delete the previous character. Ctrl+T Transpose character Switch positions of current and previous characters. Alt+T Transpose words Switch positions of current and previous words. Alt+U Uppercase word Change the current word to uppercase. Alt+L Lowercase word Change the current word to lowercase. Alt+C Capitalize word Change the current word to an initial capital. Ctrl+V Insert special character Add a special character. For example, to add a Tab character, press Ctrl+V+Tab.
Keystrokes for Cutting and Pasting Text from within Command Lines
Keystroke Full Name Meaning Ctrl+K Cut end of line Cut text to the end of the line. Ctrl+U Cut beginning of line Cut text to the beginning of the line. Ctrl+W Cut previous word Cut the word located behind the cursor. Alt+D Cut next word Cut the word following the cursor. Ctrl+Y Paste recent text Paste most recently cut text. Alt+Y Paste earlier text Rotate back to previously cut text and paste it. Ctrl+C Delete whole line Delete the entire line.
The bash shell offers several different ways of completing partially typed values. To attempt to complete a value, type the first few characters, and then press Tab. Here are some of the values you can type partially from a bash shell:
■ Command, alias, or function — If the text you type begins with regular characters, the shell tries to complete the text with a command, alias, or function name.
■ Variable — If the text you type begins with a dollar sign ($), the shell completes the text with a variable from the current shell.
■ Username — If the text you type begins with a tilde (~), the shell completes the text with a username. As a result, ~username indicates the home directory of the named user.
■ Hostname — If the text you type begins with an at (@) sign, the shell completes the text with a hostname taken from the /etc/hosts file.
If you want more information on the same there is a nice document on the same at sourceforge on the Linux shortcuts and Commands which you can read for more info.
In case of any ©Copyright or missing credits issue please check CopyRights page for faster resolutions.