Differences between current version and predecessor to the previous major change of TabCompletion.
Other diffs: Previous Revision, Previous Author, or view the Annotated Edit History
Newer page: | version 2 | Last edited on Friday, July 29, 2005 10:18:19 am | by JohnMcPherson | |
Older page: | version 1 | Last edited on Monday, August 18, 2003 12:59:05 pm | by CraigBox | Revert |
@@ -1,5 +1,36 @@
-A time-saving tool is known as command completion, currently known as Tab Completion. If you type part of a file, command, or pathname and then press the [
[Tab] key, bash(1) will present you with either the remaining portion of the file/path, or a beep (if sound is enabled on your system). If you get a beep, just press [
[Tab] again to obtain a list of the files/paths that match what has been typed so far.
+A time-saving tool is known as command completion, currently known as Tab Completion. If you type part of a file, command, or pathname and then press the ~
[Tab] key, bash(1) will present you with either the remaining portion of the file/path, or a beep (if sound is enabled on your system). If you get a beep, just press ~
[Tab] again to obtain a list of the files/paths that match what has been typed so far.
-For example, if you forget the command updatedb, but remember a portion of the command, you can su to root, then at the shell prompt, type up, press the [
[Tab] key twice and you will see a list of possible completions, including updatedb and uptime. By typing the partial command upd and pressing [
[Tab] again, your command is completed for you.
+For example, if you forget the command updatedb, but remember a portion of the command, you can su to root, then at the shell prompt, type up, press the ~
[Tab] key twice and you will see a list of possible completions, including updatedb and uptime. By typing the partial command "
upd"
and pressing ~
[Tab] again, your command is completed for you.
-You can enable this
on Windows 2000 - see WindowsNotes. There might be more to see in BashNotes, too
.
+!!bash(1)
+You may need to <tt>source /etc/bash_completion</tt> before you get extra programmable completion features, if your system doesn't already source this for interactive shells.
+
+!!zsh(1)
+Zsh has a more powerful tab-completion mechanism than bash. This comes at the cost of slightly more processing and bloat, although these days you won't notice. To get the advanced shell function-based completion, you need to run the <tt>compinstall</tt> function once (which will set up your .zshrc file for future use).
+
+Examples include:
+<verbatim>
+$ ls -l
+total 1
+-rw-r--r-- 1 me me 0 Jul 29 09:45 file1
+-rwxr-xr-x 1 me me 0 Jul 29 09:45 file2*
+$ chmod -x [TAB]
+</verbatim>
+completing to only those files that currently have the +x permission set -- in this case, <tt>file2</tt>.
+
+<verbatim>
+$ tar [TAB]
+A -- append to an archive
+c -- create a new archive
+f -- specify archive file or device
+t -- list archive contents
+u -- update archive
+v -- verbose output
+x -- extract files from an archive
+</verbatim>
+tells you all the available options for this command (and what they do), based on any options you have already added. For <tt>tar</tt>, it will only complete files ending in ".gz" or ".bz2" if the <tt>-z</tt> or <tt>-j</tt> option is given, respectively.
+
+See the zshcompsys ManPage for details on customising the completion rules.
+
+----
+
You can enable limited tab-completion
on Windows 2000 - see WindowsNotes.