51

I have quad-core processor system. I was using Windows before installing Ubuntu. Windows by-default was using 1 core* and I could change that with msconfig. How can I do this in Ubuntu or is it necessary?

Windows was using one core for booting.

2
  • 1
    I feel it's important to note that Windows wasn't only using one core. The entry in MSConfig is talking about how many cores it should use in the booting process, and I'm fairly sure it's only useful to limit that number. I see no reason why it wouldn't use all of them by default.
    – Phoshi
    Feb 17, 2013 at 15:02
  • 1
    Windows uses all cores by default. The startup option in msconfig is for limiting the number of processors. When limit is not enabled, textbox shows "1" which might look like the current running value, but it's not. It's merely the minimum you can type there. Feb 17, 2013 at 15:38

5 Answers 5

64

Type:

lscpu

in the terminal and press ENTER.

Now you have the info on cores used in your Ubuntu installation.

1
  • 1
    Also - whatch out the line ex.: Core(s) per socket:4, it tells U the exact amount of Cores on the machine. Mar 19, 2014 at 15:39
57

You can see the usage of your CPU cores using top command.

  1. Open a Terminal.
  2. Type top. You will see some information about tasks, memory etc.
  3. Type 1 to show individual CPU usage. You will see something like:

top

To start a new process which should execute only in one core, you can use taskset command.

taskset -c 0 executable

To monitor the existing process's CPU affinity, you can use this command:

taskset -cp $(pgrep -f executable)

note that the executable identity you will pass to this command can be './executable' if you started it that way.

2
  • This is a good answer, because it makes use of the top command which we always use anyway. I also never knew about taskset.
    – Donato
    May 17, 2015 at 22:37
  • [jalal@ivcgpu1 divided]$ taskset -cp $(pgrep -f executable) taskset: invalid PID argument: '-cp'
    – Mona Jalal
    Jan 16, 2018 at 19:15
12

As you have not specified your Desktop environment I will assume you are using Using Ubuntu

For a graphical way to check your cpu usage, search your system for an application called System monitor.

The Resources tab will show activity of each core

enter image description here

Whilst the Processes tab will show cpu usage for individual programmes.

enter image description here

12

htop tool provides graphs for cpu core(s) usage

install htop via terminal:

apt-get install htop

run htop via terminal:

htop

htop in the ubuntu terminal looks like this

3
  • 5
    I recommend expanding this to explain how to use it for that purpose and to show what it looks like (when used this way). Feb 17, 2013 at 15:15
  • You have not even mentioned how to install it, as it doesn't come with the system.
    – RolandiXor
    Nov 23, 2013 at 22:50
  • Nice complement to top!
    – epsilone
    Jun 21, 2016 at 16:13
4

Sensors does this too, but it also tells you the temperature the cores are running at, very cool.

Type sensors in the terminal and it will tell you if you already have it installed, once it's installed you just write sensors here be sensors

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .