Linux Command Line Tips

Updated by Edward Angert Written by Edward Angert

Contribute on GitHub

Report an Issue | View File | Edit File

These are just a few of the many commands and tricks available in the Linux terminal. Visit our guide for a deeper introduction to Linux concepts.

Basic Linux Terminal Things to Know

  • Scroll through previous commands with the Up arrow on your keyboard. Press Enter to send the command.
  • Stop the current process and get back to the prompt: CTRL+C
  • Use the TAB key to autocomplete commands and file paths

Easy Ways to Fix or Undo Text in the Terminal

  • Jump left one word: ESC+B
  • Jump right one word: ESC+F
  • Jump to the beginning of the line: CTRL+A
  • Jump to the end of the line: CTRL+E
  • Delete the previous word: CTRL+W
  • Clear the entire line: CTRL+U

Quickly Find and Replace within the Last-Entered Command

This is especially useful for both fixing typos and re-running system commands.

In the following example, we correct the typo in the first line using the command in the second:

sudo apt update && sudp apt upgrade

Use it to change the action in a system command:

sudo systemctl stop nginx.service

Redo the Previous Command with Sudo

sudo !!

Exit Vi(m)

Found your way into the Vi(m) editor?

  • To exit without saving: ESC then :q!
  • Save and exit: ESC then :wq

Join our Community

Find answers, ask questions, and help others.

comments powered by Disqus

This guide is published under a CC BY-ND 4.0 license.