The

Art

Bay

How To Get Cpu Architecture In Linux

As we learned, every computer has two main components: the processor and the memory. The processor is what does the actual work of your computer- it controls all of the functions of your computer (email, internet browsing, gaming, etc).

The other important component is the memory. This is how you store information that can be accessed quickly. Almost everything else (like files) are stored in the memory as well!

When working with processors and memories, there is one thing that changes depending on the size of the device - its architecture. Different architectures mean different ways of storing or identifying parts of the memory or the processor itself!

In this article, we will discuss some common cpu architectures and their effects on software. You will learn about such architectures like x86, ARM, MIPS, and others.

Look at the “Features” section

how to get cpu architecture in linux

In this article, we will be talking about some cool features for Linux users that can easily identify your processor’s architecture. Most of these tools use either built-in commands or third party libraries to gather the information you want.

There are several ways to access CPU arch info including using lscpu command, cpuid command, and looking at /proc/cpuinfo file. All three of these work well but have different strengths depending on what you are trying to find!

The lscpu tool is one of the most common ones used for gathering system level hardware information. It gives very detailed information which sometimes includes things like GPU model and manufacturer.

However it does not give any more specific information than that unless you add the option ‘cacheline size’ or ‘l1d cache size’. These two options must be put after the name of the feature (e.g. L2) and then the sizes separated by commas. For example, if your computer has an Intel Core i3 2100 processor with 4MB of L2 cache, you would type into lscpu -c cache line size *4* and 5MB for both values.

Another way to get additional details about processors is to run the cpuid command. This command requires root access so make sure you do that before running it! The cpuid command allows you to query various parts of the processor such as its brand, core count, etc.

Run the command cat /proc/cpuinfo | grep “flags”

how to get cpu architecture in linux

The first thing you will notice about this command is that it produces no output! This makes sense because most of the time, people use this tool to check if the computer has more than one processor or not.

If there are multiple processors, then the flag for architecture will be indicated as having the string x86_64 next to it. If there is only one processor, then no such indicator exists so we look at the other flags to determine what type of processor it is.

The second important piece of information is the cpuid field which indicates whether or not the processor has speed scaling technology like Intel® SpeedStep™ Technology or AMD Ryzen™ Processor Auto Tuning. These types of processors have dedicated logic that monitors how much CPU power they have and automatically boosts the clock rate when needed to maintain performance.

Run the command cat /proc/cpuinfo | grep “sar”

how to get cpu architecture in linux

The first thing we will do is run the command cat /proc/cpuinfo, which will show us all of our processors and their properties.

Then we will use the grep function along with some delimiters to look for the string sar. This strings represents System Administrator Role. We want this string to be present, so that means we enter 1 as the value for the second argument. Our final command looks like this:

cat /proc/cpuinfo | grep -i "sar"

After running this command, you will see one or more lines starting with flags\t followed by a number describing your processor architecture.

Here are the important numbers to note:

Flags – These describe the features of your processor such as if it has MMX or not, SSE instructions, etc.

– These describe the features of your processor such as if it has MMX or not, SSE instructions, etc. Numbers – These represent different settings for advanced optimizations such as cache size and TLB sizes.

– These represent different settings for advanced optimizations such as cache size and TLB sizes. Extensions – If your processor does not have these, then chances are it is also not using x86 extensions either.

For example, my computer only has two architectures listed- Pentium 4 (x86) and Intel Core i3 (MMX, SSE).

Run the command cat /proc/cpuinfo | grep “sar” | grep “cache”

how to get cpu architecture in linux

The first thing we need to do is run this command, which will show us all of our CPUs and what each one can do. You can also add any additional settings or commands to see more information.

The command starts with an initial line called ‘cat’, which means ‘command prompt’. Next it has '/proc/cpuinfo', which refers to a file that contains information about your processors. This file only includes basic info such as model, manufacturer, and if it has hyper-threading (HT).

After that comes '| grep sar'. What this does is search through the output for the word'sar' which is short for SpeedStep Aware. If you have HT then there would be both lines including 'ht' next to each other. A quick way to tell whether your processor is capable of using HT is by looking at those lines and seeing if either one says 'yes'.

Run the command cat /proc/cpuinfo | grep “sar” | grep “cache” | grep “l1”

how to get cpu architecture in linux

The first word you will see in the output is cache, this is your L1 or instruction caching unit. This can be either shared memory (shared between all CPUs) or separate caches per CPU.

Next you will want to identify what kind of cache it is, usually referred to as the level one (L1), Level two (L2) and so on up to the last level three (L3). Each higher level cache works better than lower levels until it is filled.

Once you have determined which level your cache is at you can now manipulate how much space it has by changing the size of the cache. You can also add more layers to help speed up processing by adding an additional layer of cache!

There are several ways to determine your processor architecture such as using cpu-top or looking into settings in advanced graphics tools.

Run the command cat /proc/cpuinfo | grep “sar” | grep “cache” | grep “l1” | grep “cache_alignment”

how to get cpu architecture in linux

The first line of output is your cache size, which can be either L2 or L3 depending on what type of processor you have. This will also tell you how much shared memory there is, as well as whether it is aligned on a 4k boundary or not.

The next set of lines are for each level one cache (L1). Each has an alignment value that tells us if the data within this cache is aligned on a 4K boundary or not.

Run the command cat /proc/cpuinfo | grep “sar” | grep “cache” | grep “l1” | grep “cache_alignment” | grep “line_size”

how to get cpu architecture in linux

The first thing we will do is run the command mentioned above. This command should return all of the information about your CPUs, their caches, alignment, line sizes, and if you have an L3 cache or not.

The reason this is important is because most operating systems use the CPU architecture set up at manufacturing time as the baseline for how CPUs work. As you can probably guess, computer manufacturers like having easy access to that architecuture so they can make tweaks to improve performance!

Any differences from that baseline are what determine whether or not a faster speed chip is worth it. For example, some processors have separate instruction and data caches which increase performance slightly but cost more money to produce. Aligning memory with the processor’s lines of logic also increases performance, however, it costs extra electricity to run those chips.

By knowing these details, you will be able to pick out any wasted potential your cpu has.

Run the command cat /proc/cpuinfo | grep “sar” | grep “cache” | grep “l1” | grep “cache_alignment” | grep “line_size” | grep “physical_address_size”

how to get cpu architecture in linux

The first thing we will do is run the command mentioned above. This will pull up several pieces of information about your computer’s CPUs, as well as their caches, alignment, line size, and physical address sizes.

The cpu architecture field comes from one of these lines of text that describe how many bits wide each cache level is and what byte-sized unit it uses for its internal storage. For example, if you see l2_caches which are 64KB, then each entry in this cache is 64 bytes long!

This article will focus only on getting the CPU architectures for Intel processors since they are by far the most common type.

Privacy PolicyTerms and Conditions
Copyright © 2026 The Art Bay