Linux Tip: Use Tab to Autocomplete Commands and Paths

Typing long commands and file paths in the Linux terminal is slow — and one wrong letter means an error. Press Tab and the terminal finishes the word for you.

How it works

  1. Type the first few letters of a command or a file path.
  2. Press Tab.
  3. If only one match fits, the terminal completes it for you. If nothing happens, press Tab again to see a list of possible matches.

Try it

  1. Open a terminal and type cd Doc, then press Tab — it should complete to Documents.
  2. Type a long command name halfway, like sys, press Tab, and pick from the matches if a list appears.
  3. Keep pressing Tab as you build a long path, one folder at a time.

Two handy extras

  • It works almost everywhere: Tab completion works for commands, file names, folder names, and in many programs, their options too.
  • It prevents typos: if the terminal completed it, the name is spelled right — no more “no such file or directory” from a missed letter.

Type less, make fewer mistakes. Tab is the terminal shortcut you will use every single day.

Filed under: Computer Tips