Last week, I shared some tips and tricks that I like to use when working on a terminal, in order to save myself time and quite some typing.
Now, we’re going to continue on the same path, and I will tell you about some more tricks that I find useful.
Just as last time, these tips are meant to be “vainilla” ones, i.e. they are meant to work in a default terminal on a regular distro. There are lots of installable utilities out there meant to help you while you use the terminal, but we’ll stay off them for now.
Auto-complete a command (Tab)
When giving instructions to the computer via terminal, there are times that we would like to avoid typing some long program or argument names, or the common really-long-filename-final-2.txt. Fortunately, we can use the Tab key on our keyboard to trigger the autocomplete function (that I have found so far in all default terminals, even though there may be exceptions).
Once we start typing, hitting the Tab key may have two outcomes:
- If there’s only one possible choice to complete what we’ve typed, our terminal entry will be autocompleted.
- If there’s more that one possible completion, it will autocomplete all the common characters of the possible completions (if there are any common characters), otherwise, it will display the possible completions, for you to continue typing. Note that in a BASH terminal, displaying possible completions may take two hits of the Tab key, and the first one may appear to “do nothing”.

The autocomplete function is able to complete program names, most program parameters, as well as filenames (if a filename is required by the program call we’re typing).
Clearing the screen (Ctrl+L and clear
)
Sometimes, the output of previously executed programs may be distracting for whatever we’re trying to do now, and clearing the terminal window would be appreciated. Well, there are two options for clearing the screen of a terminal. The first is using Ctrl+L, which will “scroll down” to the end of a terminal to make it seem less cluttered, while maintaining all previous output in case we want to check it out later.
The other alternative is using the included program clear
, which will actually erase all contents from the terminal (without possible recovery). To use it, just type clear
into the terminal and hit enter.
Previous Command (!!)
When working on a terminal, it is really common to forget to type something before or after our desired program call, often the sudo used to execute said program with super user’s privileges. When that kind of mistake happens, we can use the double exclamation marks (!!).
A terminal will interpret !! as “the last thing entered”, and will replace it accordingly, alongside anything other than !! that has also been typed. If we use !!, our first line of output will be the “patched” entry.

!!
. On the second entry, it is replaced by the previous command “dnf install inkscape”, ending with the complete entry as “sudo dnf install inkscape”, as seen on the first line of outputFeatured Image by Gabriel Heinzer on Unsplash
Leave a Reply