175

Is there any way to check at which clock speed my processor is running?

I have already tried cat /proc/cpuinfo but the clock speed I'm running isn't showing. I know Ubuntu 12.04 (Precise Pangolin) requires 700 MHz and VGA, but will an AMD Mobile Sempron work?

  • You need more specific on the second part of your question. Do you know the model number? – LiveWireBT Nov 20 '12 at 6:55
  • Thank you for all the answers but I am good now! – user1610406 Nov 20 '12 at 23:04

16 Answers 16

188

From the command line type lscpu. The information will be at CPU MHz:

~$ lscpu | grep MHz
CPU MHz:               804.901
CPU max MHz:           3200.0000
CPU min MHz:           800.0000
  • 12
    Note that the value of CPU MHz is not fixed and may change by the second. – Cerin Jan 30 '14 at 15:53
  • 18
    If you'd like to have it update in real-time, this will help: watch -n1 "lscpu | grep 'MHz' | awk '{print $1}'". – Amal Murali Nov 16 '14 at 14:39
  • 1
    @Ivan: Sorry, disregard that. The output of this command: watch -n1 "lscpu | grep 'MHz' | awk '{print $1}'" – Amal Murali Dec 21 '15 at 20:52
  • 3
    @Ivan: Okay, here you go: watch -n1 "lscpu | grep 'CPU MHz' | awk '{print $1}'" – Amal Murali Dec 21 '15 at 22:47
  • 1
    @Ivan: For a momentary observation, you don't need watch. This would do: lscpu | grep 'CPU MHz' | awk '{ print $3; }'. I'm not sure about the exact output you're getting on your system. I'll explain the command if that helps: first lscpu gets the full output that contains information regarding your CPU, grep then searches for CPU MHz and prints out just that line, awk takes out the $N-th block and displays it out. And if you want the result to change in real-time, then wrap the command in a watch -n1 "...". – Amal Murali Dec 22 '15 at 10:51
169

There are a couple of ways:

  1. lscpu or more precise lscpu | grep "MHz".
    This will give you the general MHz for the CPU.

    $ lscpu | grep "MHz".
    CPU MHz:               1600.000
    
  2. cat /proc/cpuinfo or more precise cat /proc/cpuinfo | grep "MHz".
    This will give you the individual MHz for each CPU Core. So if you have an Core 2 Duo, AMD Bulldozer, Core i7, etc.. it will show the MHz for each core.

    $ cat /proc/cpuinfo | grep "MHz"
    cpu MHz     : 1600.000
    cpu MHz     : 1600.000
    cpu MHz     : 1600.000
    cpu MHz     : 1600.000
    cpu MHz     : 1600.000
    cpu MHz     : 1600.000
    cpu MHz     : 1600.000
    cpu MHz     : 3400.000
    
  3. lshw -c cpu or more precise version: lshw -c cpu | grep capacity
    Will give you the general MHz. Same as lscpu.

    $ lshw -c cpu | grep capacity
    WARNING: you should run this program as super-user.
           capacity: 1600MHz
    WARNING: output may be incomplete or inaccurate, you should run this program as super-user.
    
  4. sudo dmidecode -t processor or more precise: sudo dmidecode -t processor | grep "Speed" Will not only give you a MHz in use but also the Maximum you can push / overclock your CPU to.

    $ sudo dmidecode -t processor | grep Speed
    [sudo] password for cyrex: 
        Max Speed: 4000 MHz
        Current Speed: 2666 MHz
    

Out of all of this, lshw and dmidecode provide the best information out of your CPU.

You can also target the current MHz detected by the kernel by querying the log files:

cat /var/log/dmesg | grep "MHz processor" - For the current detected MHz speed

cat /var/log/kern.log | grep "MHz processor" - For the current and past detected MHz speeds. Will not work in some cases, that is why I posted the dmesg one first.

And that's all I can remember from the top of my head. I am fairly certain there are other ways, just don't remember right now. Of course, talking about terminal ways.

  • For me, all options except dmidecode gave a false reading: I'm overclocking an intel E6600 2.4ghz chip on a gigabyte ga-965p-ds3 3.3 board with 7x multiplier & 400mhz CPU frequency to give 2.8ghz CPU, but the stock multiplier is 9 (9x266=2.4ghz) so I suspect the rest of the tools assume multiplier is stock and times that by the CPU mhz, so in my case they all give 3.6ghz. – dez93_2000 Oct 31 '14 at 22:30
  • 2
    dmidecode seems to be the only one to accurately report the clock speed when overclocking – Avindra Goolcharan Mar 1 '17 at 22:45
  • @AvindraGoolcharan Actually that is very good to know. Thank you. – Luis Alvarado Mar 1 '17 at 23:06
  • 1
    Note that the information from dmidecode generally can't be trusted to be accurate for your system because it just reads data from the DMI tables, which may be wrong. The man page for dmidecode even says the information is "possibly unreliable", and goes on: "The DMI table doesn't only describe what the system is currently made of, it also can report the possible evolutions (such as the fastest supported CPU or the maximal amount of memory supported)." "More often than not, information contained in the DMI tables is inaccurate, incomplete or simply wrong." – Cerran Jul 28 '17 at 17:03
  • 1
    You don't need to cat /path/to/file | grep "some string" - you can just grep the file directly instead: grep "some string" /path/to/file. Awesome answer, though. – mgarey Apr 2 at 21:43
89

For the current CPU speed one can dynamically watch this change in real time using:

sudo watch -n 1  cat /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_cur_freq

To see the maximum CPU speed, use:

cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_max_freq 
  • 4
    +1, I know this is an Ubuntu site, but this appears to be the only answer providing a command that is completely OS independent. – Andy E Apr 24 '14 at 11:53
  • If you get Permission Denied trying to read scaling_max_freq, try cpuinfo_max_freq. – LightStruk Nov 7 '14 at 16:29
  • 6
    cpufreq/cpuinfo_cur_freq doesn't exist – Ken Sharp Aug 5 '16 at 23:51
  • 1
    +1, even on several ARM-based systems running ubtunu only this solution works. Each and every other "solutions" given on this page fail there, while this works everywhere. – Philippos May 9 '17 at 6:24
  • 4
    intel_pstate CPU freq driver doesn't provide cpuinfo_cur_freq. cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_driver to see what driver is currently used. BTW, cpuinfo_cur_freq is hardware's point of view and scaling_cur_freq is kernel's point of view of the current CPU frequency. More on static.lwn.net/kerneldoc/admin-guide/pm/… – Yasushi Shoji Dec 28 '17 at 11:38
15

indicator-cpufreq-selector is a nice little indicator tool which shows your current cpu frequency. You can even select the desired cpu frequency.

enter image description here

However last update for this tool was on 2015-10-19.

  • 5
    You can install it using sudo apt-get install indicator-cpufreq. – Wilf Feb 26 '14 at 23:00
  • 2
    And after installing, you'll need to reboot before it will show up. – talyric Mar 30 '15 at 19:39
  • Doesn't work well in newer Ubuntus, if at all. – Ken Sharp Aug 5 '16 at 23:51
7

I'd like to point out sudo is needed for Ian's answer above:

sudo cat /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_cur_freq

However you can get the same results without sudo using:

cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq

My favourite is to use Conky where you can paint your own picture:

Conky.gif

This sits on the right of my built-in display all the time. The relevant code for the CPU section is:

${color2}${voffset 5}Intel® i-7 3630QM 3.4 GHz: ${color1}@  ${color green}${freq} MHz   
${color}${goto 13}CPU 1 ${goto 81}${color green}${cpu cpu1}% ${goto 131}${color3}${cpubar cpu1 18}
${color}${goto 13}CPU 2 ${goto 81}${color green}${cpu cpu2}% ${goto 131}${color3}${cpubar cpu2 18}
${color}${goto 13}CPU 3 ${goto 81}${color green}${cpu cpu3}% ${goto 131}${color3}${cpubar cpu3 18}
${color}${goto 13}CPU 4 ${goto 81}${color green}${cpu cpu4}% ${goto 131}${color3}${cpubar cpu4 18}
${color}${goto 13}CPU 5 ${goto 81}${color green}${cpu cpu5}% ${goto 131}${color3}${cpubar cpu5 18}
${color}${goto 13}CPU 6 ${goto 81}${color green}${cpu cpu6}% ${goto 131}${color3}${cpubar cpu6 18}
${color}${goto 13}CPU 7 ${goto 81}${color green}${cpu cpu7}% ${goto 131}${color3}${cpubar cpu7 18}
${color}${goto 13}CPU 8 ${goto 81}${color green}${cpu cpu8}% ${goto 131}${color3}${cpubar cpu8 18}
${color1}All CPU ${color green}${cpu}% ${goto 131}${color1}Temp: ${color green}${hwmon 2 temp 1}°C ${goto 250}${color1}Up: ${color green}$uptime
6

I would just like to add i7z to this list. Contrary to the other options, this works better for CPUs in the i7, i5 and i3 series that have TurboBoost.

  • Exactly what I needed. And it also shows Vcore voltages, Turbo multipliers, C0 halts, etc. Very nice! – Andriy Makukha Mar 11 '18 at 12:56
  • Heads up, requires 30mb of ruby and assorted tools. – Gringo Suave Jun 5 '18 at 2:38
3
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
2

If you are using an embedded ARM device (such as a Raspberry or ARM based phones), you will not be able to use solutions using lscpu, dmidecode or /proc/cpuinfo because the current speed is not listed there, if the tool is at all available. Instead you have to use sysfs:

alias getcpuf='i=1; for x in $(sudo cat /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_cur_freq); do y=$(($x/1000)); echo "CPU-${i}: $y MHz"; i=$((i+1)); done;'

# getcpuf
CPU-1: 600 MHz
CPU-2: 600 MHz
CPU-3: 600 MHz
CPU-4: 600 MHz
2

Here is a straightforward way to get cpu frequencies for all CPU threads:

  1. Be sure that cpufrequtils is installed.

  2. Then in a terminal, run the following command:

    cpufreq-info | grep "frequency is"
    
1

In a terminal, enter:

cat /proc/cpuinfo | grep name

It should display the exact model of your CPU.

This Wikipedia page on the Sempron will give you detailed specifications.

1

I wanted to share this as a comment, but dont have many reputations on askubuntu, People who want to use indicator-cpufreq do not need to reboot the computer. Resetting the current X session is enough to display the icon.

sudo apt-get install indicator-cpufreq   
DISPLAY=:0 compiz --replace

You can validate the Performance and Powersave option by seeing the current frequency by

watch -d "cat /proc/cpuinfo | grep -i Mhz"

As soon as you click on a lower frequency / Powersave, the powermanagement of the CPU kicks in, thereby reducing the clock cycle.

  • The user logging out & in again (but not rebooting) would probably work as well – Xen2050 Dec 23 '18 at 1:08
1

This is my favorite:

watch -n1 "cat /proc/cpuinfo | grep 'MHz'"

Although if you have Turbo Boost (or Turbo Core if AMD), you'll probably prefer:

sudo watch -n 1 -d cpupower monitor

which uses cpupower from the linux-tools group.

1

This works fine for real-time processor speeds

 watch "grep 'cpu MHz' /proc/cpuinfo"

While this is active, you can also spam the processor to see what maximum real-time speeds it can reach by openssl speed

0

Sample output of cat /proc/cpuinfo

processor   : 0
vendor_id   : GenuineIntel
cpu family  : 6
model       : 69
model name  : Intel(R) Core(TM) i7-4500U CPU @ 1.80GHz
stepping    : 1
microcode   : 0x17
cpu MHz     : 774.000
cache size  : 4096 KB
physical id : 0
siblings    : 4
core id     : 0
cpu cores   : 2
apicid      : 0
initial apicid  : 0
fpu     : yes
fpu_exception   : yes
cpuid level : 13
wp      : yes
flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 fma cx16 xtpr pdcm pcid sse4_1 sse4_2 movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm ida arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid
bogomips    : 3591.40
clflush size    : 64
cache_alignment : 64
address sizes   : 39 bits physical, 48 bits virtual
power management:

processor   : 1
vendor_id   : GenuineIntel
cpu family  : 6
model       : 69
model name  : Intel(R) Core(TM) i7-4500U CPU @ 1.80GHz
stepping    : 1
microcode   : 0x17
cpu MHz     : 1600.000
cache size  : 4096 KB
physical id : 0
siblings    : 4
core id     : 0
cpu cores   : 2
apicid      : 1
initial apicid  : 1
fpu     : yes
fpu_exception   : yes
cpuid level : 13
wp      : yes
flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 fma cx16 xtpr pdcm pcid sse4_1 sse4_2 movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm ida arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid
bogomips    : 3591.40
clflush size    : 64
cache_alignment : 64
address sizes   : 39 bits physical, 48 bits virtual
power management:

processor   : 2
vendor_id   : GenuineIntel
cpu family  : 6
model       : 69
model name  : Intel(R) Core(TM) i7-4500U CPU @ 1.80GHz
stepping    : 1
microcode   : 0x17
cpu MHz     : 800.000
cache size  : 4096 KB
physical id : 0
siblings    : 4
core id     : 1
cpu cores   : 2
apicid      : 2
initial apicid  : 2
fpu     : yes
fpu_exception   : yes
cpuid level : 13
wp      : yes
flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 fma cx16 xtpr pdcm pcid sse4_1 sse4_2 movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm ida arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid
bogomips    : 3591.40
clflush size    : 64
cache_alignment : 64
address sizes   : 39 bits physical, 48 bits virtual
power management:

processor   : 3
vendor_id   : GenuineIntel
cpu family  : 6
model       : 69
model name  : Intel(R) Core(TM) i7-4500U CPU @ 1.80GHz
stepping    : 1
microcode   : 0x17
cpu MHz     : 774.000
cache size  : 4096 KB
physical id : 0
siblings    : 4
core id     : 1
cpu cores   : 2
apicid      : 3
initial apicid  : 3
fpu     : yes
fpu_exception   : yes
cpuid level : 13
wp      : yes
flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 fma cx16 xtpr pdcm pcid sse4_1 sse4_2 movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm ida arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid
bogomips    : 3591.40
clflush size    : 64
cache_alignment : 64
address sizes   : 39 bits physical, 48 bits virtual
power management:

Here cpu MHz means current cpu frequency. You can run cpufreq-info to understand easily.

0

In a Linux terminal type the following command to get the CPU core name and it's current speed:

cat /proc/cpuinfo | grep -E "model name|cpu MHz"

0

sudo powertop then hit Tab twice to get to the "Frequency stats" tab.

It displays Actual frequency (accurate on my Laptop, as opposed to dmidecode), along with stats about how long is spent in each available frequency.

  • Does it have a specific line for the current frequency? Looks to just show the % of time each frequency + idle state is "active", no indication of which is active right now? – Xen2050 Dec 23 '18 at 1:07
  • @Xen2050 CPU frequency can change back and forth within milliseconds, so I'm more interested in statistics. You can run powertop -t 1 for a low delay, so that stats will be updated every second. – Rolf Dec 23 '18 at 12:30

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.