dgt_bash03 – Autocompletion and customization

Module Title: dgt_bash03 – Autocompletion and customization

Module Description:

“dgt_bash03 – Autocompletion and customization” covers the Linux command-line environment in Bash. It focuses on autocompletion, the feature that completes command-line input from existing commands, file names, and directory paths.

The practice is carried out entirely in natural language. You tell the machine what you want, for example “enable completion for kubectl and make Tab cycle through matches instead of listing them”, and it edits .inputrc and .bashrc or writes the completion function. You then read every change, understand how it hooks into Bash’s completion mechanism, test it in a fresh shell, and ask for corrections when it does not behave as you specified.

What You Will Learn:

  1. Introduction to Autocompletion in Bash:
  2. Understand the basics of how autocompletion works within the Bash shell.
  3. Explore the different autocompletion mechanisms available in Bash (e.g., filename, command, and option completion).

  4. Enabling and Configuring Autocompletion:

  5. Learn how to verify whether autocompletion is enabled on a system.
  6. Ask the machine to enable autocompletion, if it is not already active, through the bash-completion package, and check that it did so correctly.

  7. Using Bash Autocomplete Features:

  8. Understand what key combinations like Tab trigger, so you can test the completion the machine has configured.
  9. Learn about advanced behaviors such as cycling through completions and partial command suggestions.

  10. Customizing Autocompletion Behavior:

  11. Understand how configuration files like .inputrc or .bashrc change autocomplete behavior, and review the edits the machine makes to them.
  12. Explore environment-specific autocompletion customizations for different applications and services.

  13. Examples and Natural-Language Applications:

  14. Detailed walkthroughs of how autocompletion scripts are loaded into the Bash environment.
  15. Exercises in which you instruct the machine to set up autocompletion for tools like Git, Docker, and language environments (e.g., Python, Node.js), then verify the result.

  16. Troubleshooting Common Issues:

  17. Diagnose typical autocompletion problems and describe the fix precisely to the machine.
  18. Learn the best practices that prevent common autocompletion errors.

  19. Project-Based Learning:

  20. Apply your knowledge in real-world projects, directing the machine to import and configure completions for custom scripts or tools.
  21. Specify personalized completion behavior for your own workflows, and review the completion scripts the machine writes to implement it.

Target Audience:

This module is intended for system administrators, developers, IT professionals, and anyone who wants to work more efficiently with the shell. It is suitable both for those new to Bash and for experienced users.

Module Outcomes:

By the end of this module, participants will understand Bash autocompletion thoroughly and be able to have it configured exactly as they need. You will have customized your shell environment with specific completion scripts produced by the machine and reviewed by you, and gained confidence in troubleshooting related issues.

The students can push their exercises to the Academy DevOps & SRE Git project. For this module, create a folder with your username as its name in the following subfolder: https://github.com/Garanti-Del-Talento/gdt_academy