Useful Keyboard Shortcuts

There are a number of shortcuts available, with the primary advantage being that they save you a lot of typing time. This section assumes you are using the default shell provided with Mandrake Linux, bash, but these keystrokes should work with other shells too.

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 will not lose 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 is more to editing than just moving one character at a time: Ctrl+A and Ctrl+E, for example, will bring you to the beginning and the end of the current line. The Backspace and Del keys work as expected. Backspace and Ctrl+H are equivalent. Del and Ctrl+D can also be used interchangeably. Ctrl+K will delete from the position of the cursor to the end of line, and Ctrl+W will delete the word before the cursor.

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 get you back to the prompt. Ctrl+L clears the screen.

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 don't see any characters appearing on the Terminal , try Ctrl+Q. Note that all the characters you typed between the unwanted Ctrl+S and Ctrl+Q will be printed to the screen all at once.

Was this article helpful?

0 0

Post a comment