Forego the annoyance of reaching for the mouse with these keyboard shortcuts.
Exclusive use of your keyboard in the terminal is often the quickest way to get things done. In cases when it may be slower, I find that the keyboard creates a cohesive workflow, and is generally less annoying then resorting to graphical tools. If this sounds insane, you can skip this section. However, consensus from long-time command-line users favors the keyboard whenever possible. Some Linux systems, meanwhile, do not have recourse to any graphical tools (which means a cursor for point and click application).
To open a terminal, hold
To close a terminal, hold
D . You can also type
To clear your terminal screen, hold
L. You can also type:
To kill a process running in your terminal, hold
C. You can also use this to get a fresh prompt, rather than deleting each character you’ve typed individually with
Note: an aborted line (using
C) will not appear in the history of commands that BASh keeps track of. To save a line in your history without running it, prefix a
# symbol to the beginning of the line, then press
Enter. For example:
# git reset --hard c79df92c62a60a73c5d85de905e4dbd0c1afdf49
↓ keys to cycle through your history of commands.
You can search this history of commands by tapping
R, then typing a part of the command you’re looking for. BASh will select the most recent command that matches your query. To recall the next most recent, tap
R again. Continue tapping
R to go further back into your history. Once you’ve found the command, hit
Enter to execute it directly from the search function, or
→ to paste the line to your prompt, in case you want to edit it before running it again.
Navigate through the line your typing by using the horizontal arrows,
To get to a certain section of a long command more quickly, tap
→. This will allow you to hop across blocks of text, rather than each individual character.
Backspace to delete a block of text, rather than just one character at a time.
If you want to copy your current line to the the terminal window’s local clipboard, hold
Y will paste what you’ve copied. Note: these commands allow us to edit our current line and paste it later on, within the current terminal window only. To copy a line to your O S’s clipboard so that you can paste it into another application, use the
xclip command (described in the Power Tools article of this tutorial). For copying and pasting lines that you’ve already executed, or any text that appears anywhere in the terminal window, use the terminal multiplexer T Mux (also described in Power Tools).
Lastly, many commands can be auto-completed by typing part of the command, then hitting the
Tab button. If there is only one possible command, hitting
Tab once will automatically complete your command line. If there is more than one possible command, tap
Tab twice for the terminal to output a list of all possible ways to complete the command. This does not work with every command, but try it whenever you’re trying to complete a command you don’t remember or speed up your typing.
The Linux Quick-Start Guide: Directory