Solaris CLI keyboard shortcuts
As a Solaris sysadmin you will probably spend at least 80% of your time on the command line calling tools, utilities and various commands.
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 ← and → arrows to move the cursor from one end to the other on the command line. You can also press the ↑ and ↓ 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. The table below lists the majority of keystrokes used to move around the command line.
|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.|
|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.|
Cut & Paste on command-line
|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.|
bash shell there are several different ways of completing partially typed values. For example, to attempt to complete a value, type the first few characters, and then press the tab key. 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.