Honestly, follow the instructions at this link for the best results: https://github.com/squizlabs/PHP_CodeSniffer
(but the executable path is /usr/bin/phpcs on linux)
I recommend you have composer already to install this but as you can see from their instructions, you can get by without composer (it is just not as simple).
An overview of what you are doing in the instructions:
- downloading the phar files.
- Using composer to make the codesniffer available globally.
- Adding the new phpcs to your PATH system variable