Linux command
starship 命令
网络
复制后可按需替换文件名、目录或参数。
常用示例
Initialize for bash
eval "$(starship init bash)"
Initialize for zsh
eval "$(starship init zsh)"
Initialize for fish
starship init fish | source
Initialize for PowerShell
Invoke-Expression (&starship init powershell)
Print current configuration
starship print-config
Generate preset config
starship preset [pastel-powerline] > ~/.config/starship.toml
List available presets
starship preset --list
Explain active prompt segments
starship explain
Show prompt rendering times
starship timings
说明
starship is a minimal, fast, cross-shell prompt. Written in Rust, it provides consistent appearance and features across bash, zsh, fish, PowerShell, and more. Configuration in ~/.config/starship.toml customizes modules. Each module shows specific information: git status, language versions, cloud context, etc. Modules appear contextually. Python version shows only in Python projects. Git info shows only in repositories. This keeps prompts clean. Presets provide ready-made configurations. They range from minimal to information-rich, with various color schemes. Speed is a priority. The prompt renders quickly even with many modules enabled. Timings command helps identify slow modules. The prompt is cross-platform, working on Linux, macOS, and Windows. Configuration is portable across systems.
参数
- init _SHELL_
- Generate shell init script.
- prompt
- Print prompt.
- preset _NAME_
- Print preset configuration.
- print-config
- Print config.
- explain
- Explain prompt segments.
- timings
- Time prompt rendering.
- completions _SHELL_
- Generate completions.
- bug-report
- Generate bug report.
- --help
- Show help.
- --version
- Show version.
FAQ
What is the starship command used for?
starship is a minimal, fast, cross-shell prompt. Written in Rust, it provides consistent appearance and features across bash, zsh, fish, PowerShell, and more. Configuration in ~/.config/starship.toml customizes modules. Each module shows specific information: git status, language versions, cloud context, etc. Modules appear contextually. Python version shows only in Python projects. Git info shows only in repositories. This keeps prompts clean. Presets provide ready-made configurations. They range from minimal to information-rich, with various color schemes. Speed is a priority. The prompt renders quickly even with many modules enabled. Timings command helps identify slow modules. The prompt is cross-platform, working on Linux, macOS, and Windows. Configuration is portable across systems.
How do I run a basic starship example?
Run `eval "$(starship init bash)"` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does init _SHELL_ do in starship?
Generate shell init script.