Execute Commands
Log in to a Linux system and run simple commands with the shell.
Objectives
Save time when running commands from a shell prompt with Bash shortcuts.
Basic Command Syntax
Edit the Command Line
When used interactively, bash has a command-line editing feature. Use the text editor commands to move around and modify the currently typed command. Using the arrow keys to move within the current command and step through the command history was introduced earlier in this section. The following table shows further powerful editing commands.
Useful Command-line Editing Shortcuts
| Shortcut | Description |
|---|---|
| Ctrl+A | Jump to the beginning of the command line. |
| Ctrl+E | Jump to the end of the command line. |
| Ctrl+U | Clear from the cursor to the beginning of the command line. |
| Ctrl+K | Clear from the cursor to the end of the command line. |
| Ctrl+LeftArrow | Jump to the beginning of the previous word on the command line. |
| Ctrl+RightArrow | Jump to the end of the next word on the command line. |
| Ctrl+R | Search the history list of commands for a pattern. |