Linux command
has 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Check if specific tools are available
has [git] [node] [python3]
Check a list of tools
has [docker] [kubectl] [helm] [terraform]
Use in a script
has [make] [gcc] && echo "Ready to build"
说明
has is a simple shell script that checks the presence of various command-line tools on your PATH and reports their installed versions. It provides a quick way to verify that all required dependencies are available before running a build, deployment, or setup script. For each command passed as an argument, has checks if it exists on the PATH and attempts to determine its version. Found tools are displayed with a green checkmark and their version number, while missing tools are shown with a red cross. The exit status code reflects the number of commands not found.
FAQ
What is the has command used for?
has is a simple shell script that checks the presence of various command-line tools on your PATH and reports their installed versions. It provides a quick way to verify that all required dependencies are available before running a build, deployment, or setup script. For each command passed as an argument, has checks if it exists on the PATH and attempts to determine its version. Found tools are displayed with a green checkmark and their version number, while missing tools are shown with a red cross. The exit status code reflects the number of commands not found.
How do I run a basic has example?
Run `has [git] [node] [python3]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
Where can I find more has examples?
This page includes 3 examples for has, plus related commands for nearby Linux tasks.