Linux command
complete 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Complete with files
complete -f [command]
Complete with directories
complete -d [command]
Complete with word list
complete -W '[start stop restart]' [myservice]
Complete using function
complete -F [_my_completion] [mycommand]
Remove completion
complete -r [command]
List all completions
complete -p
Complete with no space after
complete -o nospace -W '[opt1 opt2]' [command]
说明
complete specifies how arguments for commands should be completed. Bash builtin for programmable completion. Defines completion specifications (compspecs) for commands.
参数
- -a
- Complete with aliases
- -b
- Complete with builtins
- -c
- Complete with commands
- -d
- Complete with directories
- -f
- Complete with files
- -g
- Complete with groups
- -j
- Complete with jobs
- -k
- Complete with keywords
- -s
- Complete with services
- -u
- Complete with users
- -v
- Complete with variables
- -A _action_
- Use action for completion
- -W _wordlist_
- Complete from wordlist
- -F _function_
- Call shell function
- -C _command_
- Run command for completions
- -G _pattern_
- Glob pattern for files
- -X _pattern_
- Filter out matches
- -P _prefix_
- Add prefix to results
- -S _suffix_
- Add suffix to results
- -p
- Print current completions
- -r
- Remove completion spec
FAQ
What is the complete command used for?
complete specifies how arguments for commands should be completed. Bash builtin for programmable completion. Defines completion specifications (compspecs) for commands.
How do I run a basic complete example?
Run `complete -f [command]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -a do in complete?
Complete with aliases