this post was submitted on 12 Aug 2023
29 points (100.0% liked)

linux4noobs

1335 readers
1 users here now

linux4noobs


Noob Friendly, Expert Enabling

Whether you're a seasoned pro or the noobiest of noobs, you've found the right place for Linux support and information. With a dedication to supporting free and open source software, this community aims to ensure Linux fits your needs and works for you. From troubleshooting to tutorials, practical tips, news and more, all aspects of Linux are warmly welcomed. Join a community of like-minded enthusiasts and professionals driving Linux's ongoing evolution.


Seeking Support?

Community Rules

founded 1 year ago
MODERATORS
 

Today's tip is a simple one many experienced users will roll their eyes at, but that is because it is so common and handy to use. When watching and helping people new to Linux, I often see them fail to utilize this powerful tool. They struggle to remember file names and commands and it hurts my soul to watch knowing how much easier it could be for them. Knowing how to use this helps you help yourself. There isn't a day that goes by I don't use this probably a hundred times.

Tab completion

Tab completion is a powerful feature in the Linux terminal that allows you to quickly complete filenames, directory paths, and commands by pressing the 'Tab' key. It can significantly speed up your workflow and reduce the chances of typos.

Benefits of using tab completion:

  • Efficiency: Saves time by reducing typing and minimizing errors.
  • Discoverability: Helps you discover available commands and file/directory names.
  • Accuracy: Reduces typos and potential mistakes.

Using Tab Completion

Completing Commands: Type the start of a command, maybe one you can't quite remember the name of, and press 'Tab' twice to see a list of available commands that match the entered text. If you've typed enough that there will only be one option, it'll complete that one for you.

Completing Filenames and Directories: When typing a file or directory name, press 'Tab' to automatically complete the name. If multiple options match, pressing 'Tab' twice will display the options.

Navigating Directories: Use tab completion to navigate through directories quickly. For example, type cd /usr/l and press 'Tab' to complete to /usr/local/.

Conclusion

It should be noted that tab completion may work slightly different depending on the terminal and other settings you may have. Pressing 'Tab' twice may bring up a full menu to select from for available files or directories, for instance. However, this overview provides the gist of how it works for most any system I regularly come across.

top 2 comments
sorted by: hot top controversial new old
[โ€“] [email protected] 4 points 1 year ago

If you feel it lacking remeber that your shell (bash, zsh) is just loading from available functions and completions scripts. Source: https://www.gnu.org/software/bash/manual/html_node/Programmable-Completion.html

[โ€“] [email protected] 4 points 1 year ago

Me guiding newbies on terminal usage:

"Hit tab."
"Hit tab."
"Tab."
"Look, just hit tab every every third keystroke."
"TAB TAB TAB!"