← 返回命令列表

Linux command

typos 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Check

typos

Check a specific

typos [path/to/file_or_dir]

Automatically fix

typos --write-changes

Preview

typos --diff

Output results as JSON

typos --format json

Include hidden files

typos --hidden --no-ignore

Use a specific

typos --locale en-gb

Check

typos --config [path/to/_typos.toml]

说明

typos is a fast spell checker tailored for source code. It walks the file tree, respects _.gitignore_ rules by default, and flags misspelled words inside identifiers, comments, and strings while keeping false positives low enough to run in pull-request gates. Detection is driven by a curated dictionary of common code typos rather than a full natural-language dictionary, so it tolerates camelCase, snake_case, abbreviations, and domain-specific jargon. Findings can be printed, written back to disk with --write-changes, or emitted as JSON for editors and CI tooling. The checker also understands per-language conventions through a file-type map, can be tuned for British or American English with --locale, and respects per-project overrides defined in \_typos.toml, typos.toml, Cargo.toml, or pyproject.toml.

参数

-w, --write-changes
Apply the suggested corrections to files instead of only reporting them.
--diff
Print proposed changes as a unified diff without modifying files.
--format _FORMAT_
Output format: _silent_, _brief_, _long_ (default), _json_.
--config _FILE_
Path to a configuration file (typically _\_typos.toml_).
--locale _LOCALE_
Set the English dialect: _en_, _en-us_, _en-gb_, _en-ca_, _en-au_.
--exclude _GLOB_
Skip paths matching the given gitignore-style pattern.
--force-exclude
Force excluded paths to be skipped even when given explicitly on the command line.
--hidden
Include hidden files and directories.
--no-ignore
Do not respect any ignore files.
--no-ignore-vcs
Do not respect ignore files inside version-control directories.
--no-ignore-dot
Do not respect _.ignore_ files.
--no-ignore-global
Do not respect global ignore files.
--no-ignore-parent
Do not respect ignore files from parent directories.
--binary
Also check binary files as if they were text.
--no-unicode
Restrict identifiers to ASCII.
--type-list
Print all known file types and their globs.
--type _TYPE_
Only check files of the given type (e.g. _rust_, _py_).
--type-not _TYPE_
Exclude files of the given type.
-V, --version
Print the version and exit.
-h, --help
Print help.

FAQ

What is the typos command used for?

typos is a fast spell checker tailored for source code. It walks the file tree, respects _.gitignore_ rules by default, and flags misspelled words inside identifiers, comments, and strings while keeping false positives low enough to run in pull-request gates. Detection is driven by a curated dictionary of common code typos rather than a full natural-language dictionary, so it tolerates camelCase, snake_case, abbreviations, and domain-specific jargon. Findings can be printed, written back to disk with --write-changes, or emitted as JSON for editors and CI tooling. The checker also understands per-language conventions through a file-type map, can be tuned for British or American English with --locale, and respects per-project overrides defined in \_typos.toml, typos.toml, Cargo.toml, or pyproject.toml.

How do I run a basic typos example?

Run `typos` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -w, --write-changes do in typos?

Apply the suggested corrections to files instead of only reporting them.