The typos is a source code spell checker via command line. It is an open-source tool that is written in the Rust programming language. This tutorial demonstrates how to install typos spell checker on Ubuntu 24.04.
Install typos
Obtain the newest version of typos directly from its GitHub repository and assign to variable:
TYPOS_VERSION=$(curl -s "https://api.github.com/repos/crate-ci/typos/releases/latest" | grep -Po '"tag_name": "v\K[0-9.]+')
Download typos using the determined version:
wget -qO typos.tar.gz https://github.com/crate-ci/typos/releases/latest/download/typos-v$TYPOS_VERSION-x86_64-unknown-linux-musl.tar.gz
Extract the executable to the /usr/local/bin
directory:
sudo tar xf typos.tar.gz -C /usr/local/bin ./typos
Execute the command to check the typos version:
typos --version
Remove the unnecessary file:
rm -rf typos.tar.gz
Testing typos
Create a simple JavaScript file for testing:
echo "console.log('Helo world');" > main.js
To use typos, simply run the command typos
followed by the file you want to check:
typos main.js
This will scan main.js
for spelling errors and report any issues found:
Uninstall typos
To remove typos, simply delete the associated file:
sudo rm -rf /usr/local/bin/typos
Leave a Comment
Cancel reply