4.6. Useful Keyboard Shortcuts First: the arrow (Web hosting companies) keys.

4.6. Useful Keyboard Shortcuts First: the arrow keys. bash maintains a history of previous commands which you can view with the up and down arrow keys. You can scroll up to a maximum number of lines defined in the HISTSIZE environment variable. In addition, the history is persistent from one session to another, so you won’t lose all the commands you typed in previous sessions. The left and right arrow keys move the cursor left and right on the current line, allowing you to edit your commands. But there’s more to editing than just moving one character at a time: Ctrl A and Ctrl -E , for example, will take you to the beginning and the end of the current line. The Backspace and Del keys work as expected. Ctrl Ctrl -K will delete from the position of the cursor to the end of line, and -W will delete the word before the cursor (so will Alt Backspace ). Typing Ctrl -D on a blank line will let you close the current session, which is much shorter than having to type exit. Ctrl - C will interrupt the currently running command, except if you were in the process of editing your command line, in which case it will cancel the editing and put you back to the prompt. Ctrl -L clears the screen. Ctrl -Z temporarily stops a task, it suspends it. This shortcut is very useful when you forget to type the & character after typing a command. For instance: $ xpdf MyDocument.pdf Hence you cannot use your shell anymore since the foreground task is allocated to the xpdf process. To put that task in the background and restore your shell, simply type Ctrl Z and then enter the bg command. - Finally, there are Ctrl S and Ctrl -Q, which are used to suspend and restore output to the screen. They are not used often, but you might type Ctrl -S by mistake (after all, S and D are close to each other on the keyboard). So, if you get into the situation where you’re typing but you can’t see any characters appearing on the Terminal, try Ctrl - Ctrl -S and Ctrl - Q . Note that all the characters you typed between the unwanted Q will be printed to the screen all at once.

Leave a Reply