Linux command
just 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
List available recipes
just --list
Run the default recipe
just
Run a specific recipe
just [recipe_name]
Run with arguments
just [recipe_name] [arg1] [arg2]
Run from a specific justfile
just --justfile [path/to/justfile] [recipe]
Show what would run
just --dry-run [recipe]
Evaluate and print all variables
just --evaluate
Run recipe in specific directory
just --working-directory [path] [recipe]
说明
just is a command runner similar to make but focused on running project-specific commands rather than building targets. It uses a justfile (similar to Makefile) to define recipes - named sets of commands. Recipes are defined with a name, optional parameters, and body of shell commands. Unlike make, just doesn't track file dependencies or timestamps; it simply runs the specified commands. This makes it ideal for task automation, development workflows, and project scripts. Variables can be defined and used with {{variable}} syntax. Environment variables are accessible, and recipes can export variables. Conditionals, default values, and error handling are supported. Just supports multiple shells (sh, bash, powershell, python, etc.) per recipe via shebang-like syntax. Recipes can have dependencies (other recipes to run first), and private recipes (prefixed with _) are hidden from --list. Cross-platform support means justfiles work on Linux, macOS, and Windows. The tool is fast (written in Rust) and has no dependencies.
参数
- -l, --list
- List available recipes.
- -n, --dry-run
- Print what would be executed without running.
- --evaluate
- Evaluate and print all variables.
- -f, --justfile _path_
- Use specified justfile.
- -d, --working-directory _path_
- Run from specified directory.
- --set _var value_
- Override variable value.
- --chooser _program_
- Use program to select recipe interactively.
- --choose
- Select recipe with chooser.
- -s, --show _recipe_
- Show recipe definition.
- --summary
- List recipes one per line.
- --dump
- Print justfile in canonical form.
- --fmt
- Format justfile.
- --check
- Check justfile for errors.
- -q, --quiet
- Suppress echoing of recipe lines.
- -v, --verbose
- Verbose output.
- --color _when_
- Color output: auto, always, never.
- --shell _shell_
- Shell to use for recipes.
FAQ
What is the just command used for?
just is a command runner similar to make but focused on running project-specific commands rather than building targets. It uses a justfile (similar to Makefile) to define recipes - named sets of commands. Recipes are defined with a name, optional parameters, and body of shell commands. Unlike make, just doesn't track file dependencies or timestamps; it simply runs the specified commands. This makes it ideal for task automation, development workflows, and project scripts. Variables can be defined and used with {{variable}} syntax. Environment variables are accessible, and recipes can export variables. Conditionals, default values, and error handling are supported. Just supports multiple shells (sh, bash, powershell, python, etc.) per recipe via shebang-like syntax. Recipes can have dependencies (other recipes to run first), and private recipes (prefixed with _) are hidden from --list. Cross-platform support means justfiles work on Linux, macOS, and Windows. The tool is fast (written in Rust) and has no dependencies.
How do I run a basic just example?
Run `just --list` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -l, --list do in just?
List available recipes.