Skip to main content

Unit 3 路 Linux^2 路 Lesson 31 of 34

Work harder, not smarter, wait...

Tab, history, and other shortcuts

At this point you've typed a lot of commands, and your fingers are probably tired. Good news, Linux has your back.

Tab completion

Start typing a file name or command and press Tab. Linux will finish it for you.

If there's more than one match, press Tab twice and it'll show you all the options. This also saves you from typos, which is huge.

history

history shows a numbered list of the commands you've run recently.

[user@linux]$ history

It's just output like anything else, so you can pipe it into grep to find that one command from last week:

[user@linux]$ history | grep nano

Shortcuts you'll use constantly

ShortcutWhat it does
!!Runs your last command again
sudo !!Runs your last command again, but with sudo (for when you forget the first time, which you will)
Ctrl+RSearch through your history by typing part of a command
Ctrl+CStops whatever command is currently running
Ctrl+LClears your screen (same thing as the clear command)

馃毃 Ctrl+C is the big one. If something is stuck or spamming your screen, Ctrl+C is your emergency exit.


Try it

Whoever used this account before you was careless. They typed a flag (cyber{...}) right into the terminal once, then kept going for hundreds of commands. The terminal remembers all of them.

Scrolling with the up arrow is technically an option. It's a bad option.

There's also a program called spam in your home folder. It does exactly what it sounds like.

Live Linux terminal

This lesson comes with a real Ubuntu machine that runs in your browser, so you type every command yourself. Create a free account to do this part.

Do this lesson for real

With a free account you get the terminal, the challenges and the checks that go with every lesson in Intro to Linux, and your progress is saved as you go. CyberAcad is a 501(c)(3) nonprofit, so there is nothing to pay.