Publishers of technology books, eBooks, and videos for creative people

Home > Articles

  • Print
  • + Share This
  • 💬 Discuss

Using Completion in the zsh Shell

The zsh shell also offers completion but with added twists over the bash shell for the power user. Basically, though, you can type just part of a command, press tab.jpg, and have the Z-shell complete the command for you (Code Listing 3.10).

Code Listing 3.10. In this example, we typed only the ls command followed by cd pub and pressed the key; zsh completed the command for us.

$ ls
CompleteNewProject  bogus2
→ ftp   puppy
Completed     News    dead.letter
→ mail  temp
Mail  access files
→ public_html   testme
$  cd public_html/
$

To use completion in the zsh shell:

  1. ls -l

    Use ls -l to list the files in your current directory.

  2. cd pub tab.jpg

    Type in a partial command, and then press tab.jpg to complete the command. In this example, we typed the cd command and part of the public_html directory (truncated to pub in the example), and then pressed the tab.jpg key to complete it (see Code Listing 3.10).

  • + Share This
  • 🔖 Save To Your Account

Discussions

comments powered by Disqus