How do I install the perf monitoring tool?

  • 2
    What exactly do you want to monitor?
    – ddeimeke
    Jun 23 '11 at 7:31
  • 7
    @ddeimeke that seems like an irrelevant question.
    – dbliss
    Oct 16 '15 at 17:20
  • @ddeimeke it doesn't matter
    – SmallChess
    Jul 28 '18 at 0:47

12 Answers 12


On Ubuntu I had to install three packages:

apt-get install linux-tools-common linux-tools-generic linux-tools-`uname -r`
  • 5
    When I tried it, just using sudo apt-get install linux-tools-common linux-tools-generic (skipping the part, which depends on the kernel version) was sufficient.
    – Martin R.
    Jun 29 '15 at 22:17
  • 6
    @Martin-R linux-tools-generic always points at the tools for the most up to date kernel version. When running an older kernel (e.g. a server with a couple months uptime) if you want perf without rebooting to the newer kernel you have to explicitly install the tools paired with that kernel (hence the uname -r shell expansion).
    – notpeter
    Jun 30 '15 at 6:09
  • sudo apt-get update sudo apt-get -y install linux-tools-common linux-tools-generic linux-tools-uname -r
    – dylanninin
    Jun 19 '16 at 3:10
  • 3
    sudo apt install linux-tools-generic on ubuntu 18.04
    – huangli
    Feb 3 '20 at 9:17

The perf utility can be found in the linux-tools package.

  • 15
    You also probably want to install linux-tools-generic since it includes kernel modules that perf interacts with.
    – Allen
    Sep 6 '14 at 21:59
  • 1
    Yep @Allen linux-tools-generic was what I needed!
    – jerome
    Mar 24 '16 at 15:00

Make sure you are installing this tool for the right Kernel release. If you just type:

sudo apt-get install linux-tools

It will install it for the latest Linux release in your machine and in case you are booting a previous version (say for stability reason), it will err. In my case it installed for .45 instead of .43 and I had to use the following command to install it:

sudo apt-get install linux-tools-

You can find your Kernel release by typing : uname -r

To make sure it's working right you can try this: perf record /bin/ls

Just in case you are going to install Zoom tool, you need to have Perf installed for being able to use all its utilities.


To get the latest version of perf irrespective of the kernel version (perf version is independent of the kernel version):

git clone --depth 1 https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
cd linux/tools/perf
cp perf /usr/bin

perf --version to check the current version

  • Build deps for reference apt-get install build-essential git flex bison Aug 24 '21 at 11:01

In 14.04, the linux-tools package does not exist unqualified:

$ sudo apt-get install linux-tools
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package linux-tools is a virtual package provided by:
You should explicitly select one to install.

E: Package 'linux-tools' has no installation candidate

Instead, you can install one of the packages listed, depending upon the kernel you have installed. Most users will want linux-tools-generic.



sudo apt install linux-tools-common



sudo apt install linux-perf



I installed Linux 3.17.2 on my machine and tried

sudo apt-get install linux-tools-3.17.2

it showed that linux-tools is not present. In this case, download the required linux kernel version, go to linux->tools->perf :

cd linux/tools/perf

and then run make command :


and then run make install command:

make install

and then reboot. You just installed perf manually.

  • Reboot is not necessary. Also, if you are to compile from the source code; linux-tools-3.17.2 should not be necessary Oct 19 '16 at 10:03

Running the following two commands will do it!

sudo apt-get install linux-tools-common 
sudo apt-get install linux-tools
  • Doesn't work. I'm using 12.04. I get the error perf not found for kernel 3.2.0-60. You may need to install linux-tools-3.2.0-60-generic
    – Rishi Dua
    Mar 10 '14 at 18:54
  • This doesn't look working.
    – SmallChess
    Jul 28 '18 at 0:52

Here's how it worked for me On Ubuntu 18.04:

After Command 'perf' not found, it suggested to install with sudo apt install linux-tools-common. Doing so and trying to run perf afterward still resulted in:

WARNING: perf not found for kernel 4.15.0-39

  You may need to install the following packages for this specific kernel:

  You may also want to install one of the following packages to keep up to date:

I decided for sudo apt-get install linux-tools-generic and this was enough.

In case you run into permission-error when trying to use perf as non-root, look here:

Run perf without root-rights

  • I got the same warning. But then I ran the command you suggested and I still get the same warning.
    – 6005
    Mar 20 '19 at 21:40
  • linux-tools-oem seems to have been enough.
    – 6005
    Mar 20 '19 at 21:42
  • 1
    @6005 Thx for the feedback, I don't have an idea why you experienced a different behaviour, though.
    – Darkonaut
    Mar 20 '19 at 21:47

On ubuntu "perf" is a shell script that calls a kernel specific perf binary.

But that's not actually needed, perf is compatible. Just remove the wrapper from /usr/bin and copy any of the perf binaries from ./lib/linux-tools* to it.


For debian 9.11 (Stretch)

sudo apt-get install linux-perf-4.9


You might need to do an

apt-get update


sudo apt-get install linux-tools-virtual
  • this answer is useless without any hint of the approach targeted
    – cmks
    Mar 15 '16 at 16:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.