rustup --versionConfirms rustup is installed and shows its current version.
Core rustup and Cargo commands for creating, building, running, and inspecting Rust CLI projects.
Install, inspect, and verify the Rust toolchain.
rustup --versionConfirms rustup is installed and shows its current version.
rustc --versionShows which `rustc` is currently active in your shell.
cargo --versionUseful for debugging toolchain mismatches and environment issues.
rustup updateUpdates channels like stable, beta, and nightly when installed.
rustup default stableSets the default toolchain used outside directories with overrides.
Use toolchain shorthand for one command.
cargo +nightly --versionCargo supports `+toolchain` shorthand when installed via rustup.
Create new Rust binary and library packages.
cargo new hello-cli`cargo new` creates a new package with a manifest and starter source.
cargo new mylib --libUse `--lib` when the package is meant to be a library crate.
Create a manifest in the current project folder.
cargo initUseful when you already created the folder or are converting existing code.
cargo init --libCreates `Cargo.toml` and a `src/lib.rs` starter file.
Print the path to the Cargo.toml file Cargo will use.
cargo locate-projectHelpful when working in nested directories or workspaces.
cargo metadata --format-version 1Frequently used by tooling and scripts to inspect crates and workspaces.
Explore Cargo commands and built-in help.
cargo helpLists commands and global options.
cargo help buildEquivalent to the command-specific manual page for build.
which cargoUseful when multiple toolchain installs exist on the machine.
Display installed toolchains, defaults, and active host.
rustup showShows the active toolchain and installed targets/components.
Common `Cargo.toml` structures for CLI apps.
[package]
name = "hello-cli"
version = "0.1.0"
edition = "2021"`Cargo.toml` is the package manifest written in TOML.
[dependencies]
clap = { version = "4", features = ["derive"] }
anyhow = "1"Dependencies are normally declared in the `[dependencies]` table.
[[bin]]
name = "admin-tool"
path = "src/bin/admin-tool.rs"Binary packages can expose additional executables with `[[bin]]` targets.
[package]
rust-version = "1.75"The manifest supports declaring a minimum supported Rust version.