phpcs command not found
Introduction
When you run more command in linux terminal / console, you get the following error message
phpcs: command not found
or when using sudo you get the following error message
sudo: phpcs: command not found
Solutions to phpcs: command not found
How To Fix phpcs: command not found in Ubuntu / Debian / Kali Linux / Raspbian
In Ubuntu phpcs is provided by php-codesniffer package.
php-codesniffer is:
PHP_CodeSniffer is a set of two PHP scripts; the main phpcs script that tokenizes PHP, JavaScript and CSS files to detect violations of a defined coding standard, and a second phpcbf script to automatically correct coding standard violations. PHP_CodeSniffer is an essential development tool that ensures your code remains clean and consistent.
To fix this problem, we can install more using the command below.
sudo apt-get -y install php-codesniffer
This command might take some time to finish depending on your machine internet connection.
You can also use apt command to install php-codesniffer.
sudo apt -y install php-codesniffer
Or if you have aptitude installed you can use the following command.
sudo aptitude install php-codesniffer
Summary
In this tutorial we learn how to fix phpcs command not found error in Ubuntu / Debian / Kali Linux or Raspbian distribution.