How can I install clang-format in Ubuntu?
clang-format is not available in the ubuntu-precise 12.04 but it is available in ubuntu saucy http://packages.ubuntu.com/saucy/clang-format-3.4.
in order to find this package with the apt-cache we have to add below list into our repository list. Actually below list is generated for the singapore servers but if you want to look for your own country you can use http://repogen.simplylinux.ch/generate.php
After generating your list, you have to add them into your repository, you can learn how to do that by looking to here. https://help.ubuntu.com/community/Repositories/CommandLine
The list of packages are;
deb http://sg.archive.ubuntu.com/ubuntu/ saucy main restricted universe multiverse
deb-src http://sg.archive.ubuntu.com/ubuntu/ saucy main restricted universe multiverse
deb http://sg.archive.ubuntu.com/ubuntu/ saucy-security main restricted universe multiverse
deb http://sg.archive.ubuntu.com/ubuntu/ saucy-updates main restricted universe multiverse
deb http://sg.archive.ubuntu.com/ubuntu/ saucy-proposed main restricted universe multiverse
deb http://sg.archive.ubuntu.com/ubuntu/ saucy-backports main restricted universe multiverse
deb-src http://sg.archive.ubuntu.com/ubuntu/ saucy-security main restricted universe multiverse
deb-src http://sg.archive.ubuntu.com/ubuntu/ saucy-updates main restricted universe multiverse
deb-src http://sg.archive.ubuntu.com/ubuntu/ saucy-proposed main restricted universe multiverse
deb-src http://sg.archive.ubuntu.com/ubuntu/ saucy-backports main restricted universe multiverse
Then you should search clang-format with below command first
sudo apt-cache search clang-format
Then, you can install which version you want to install such as;
sudo apt-get install clang-format-3.3
With Ubuntu 16.04, simply do:
sudo apt install clang-format