LinuxCommandLibrary

cargo-version

Display cargo and rustc version information

TLDR

Display version

$ cargo version
copy

Display additional build information
$ cargo version [[-v|--verbose]]
copy

SYNOPSIS

cargo version

DESCRIPTION

The cargo-version command, invoked as cargo version, is a crucial subcommand of the Rust package manager, Cargo. Its primary function is to display detailed version information about the Cargo tool itself, the underlying rustc (Rust compiler) it uses, and often includes details about the active rustup toolchain (e.g., stable, beta, nightly) and its build date. This command is invaluable for debugging and understanding the Rust development environment, especially when dealing with version-specific issues or ensuring consistent toolchain usage across projects. It provides a quick snapshot of the Rust ecosystem components in use, aiding in reproducibility and problem diagnosis. Unlike cargo --version, which provides a concise output, cargo version offers more comprehensive details about the toolchain and its build environment.

CAVEATS

This command is a subcommand of cargo, not a standalone executable. It does not accept any specific command-line options that alter its behavior or output, beyond global cargo options (which rarely apply or have an effect on this particular subcommand). The output might vary slightly depending on whether rustup is installed and actively managing the Rust toolchain, as it often includes rustup toolchain information.

DISTINCTION FROM CARGO --VERSION

While cargo version provides detailed toolchain information (e.g., build date, toolchain name, host triple), cargo --version offers a more concise output, typically showing only the Cargo version and the rustc version. Both commands serve to inform about the installed versions but cater to slightly different levels of detail and typical usage scenarios.

HISTORY

Cargo, the Rust package manager, was developed alongside the Rust programming language to automate project dependency management and build processes. The version subcommand has been a fundamental diagnostic tool from early in Cargo's development. Its utility significantly increased with the introduction of rustup, the Rust toolchain installer, which allows users to easily switch between different Rust versions (stable, beta, nightly), making it crucial to quickly identify the currently active toolchain.

SEE ALSO

cargo(1), rustc(1), rustup(1)

Copied to clipboard