Linux Quick-Start Guide: Keyboard Shortcuts

Joseph Syverson
Dec 12, 2019 · 3 min read
Alexander the Conqueror showed the World that sometimes the best way to untie a knot is to cut right through it. Source.

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 Ctrl Alt T.

To close a terminal, hold Ctrl Alt D . You can also type

exit

To clear your terminal screen, hold Ctrl L. You can also type:

clear

To kill a process running in your terminal, hold Ctrl C. You can also use this to get a fresh prompt, rather than deleting each character you’ve typed individually with Backspace.

An aborted command

Note: an aborted line (using Ctrl 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

Press your and keys to cycle through your history of commands.

You can search this history of commands by tappingCtrl 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, tapCtrl R again. Continue tappingCtrl 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.

The reverse search function: here the query is ‘git re’.

Navigate through the line your typing by using the horizontal arrows, and .

To get to a certain section of a long command more quickly, tap Alt and Alt . This will allow you to hop across blocks of text, rather than each individual character.

Use Alt 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 Ctrl U. Ctrl 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

Joseph Syverson

Written by

essayish.com

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade