Linux ram and cpu

Linux: How to get CPU and memory information

To see what type of processor/CPU your computer system has, use this Linux command:

As you can see, all you have to do is use the Linux cat command on this special /proc/cpuinfo file on your Linux system. (See below for sample processor output.)

How to show Linux memory information

To see your Linux memory information and memory stats use this command:

(See below for sample output.)

Linux processor command output

When I issue that Linux processor information command on my current hardware system, I see this output:

# cat /proc/cpuinfo processor : 0 vendor_id : GenuineIntel cpu family : 15 model : 4 model name : Intel(R) Pentium(R) 4 CPU 3.00GHz stepping : 1 cpu MHz : 3007.103 cache size : 1024 KB physical id : 0 siblings : 2 core id : 0 cpu cores : 1 fdiv_bug : no hlt_bug : no f00f_bug : no coma_bug : no fpu : yes fpu_exception : yes cpuid level : 5 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe constant_tsc pni monitor ds_cpl cid xtpr bogomips : 6016.05 processor : 1 vendor_id : GenuineIntel cpu family : 15 model : 4 model name : Intel(R) Pentium(R) 4 CPU 3.00GHz stepping : 1 cpu MHz : 3007.103 cache size : 1024 KB physical id : 0 siblings : 2 core id : 0 cpu cores : 1 fdiv_bug : no hlt_bug : no f00f_bug : no coma_bug : no fpu : yes fpu_exception : yes cpuid level : 5 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe constant_tsc pni monitor ds_cpl cid xtpr bogomips : 6012.84

From that output I can see my current system is a two-processor Intel system, with additional information about the Intel CPU (CPUs, actually).

Linux memory information command

When I issue the Linux memory information command, I see the following output:

# cat /proc/meminfo MemTotal: 2067508 kB MemFree: 92788 kB Buffers: 246168 kB Cached: 1362296 kB SwapCached: 0 kB Active: 1073132 kB Inactive: 637304 kB HighTotal: 1171392 kB HighFree: 7228 kB LowTotal: 896116 kB LowFree: 85560 kB SwapTotal: 2096472 kB SwapFree: 2096352 kB Dirty: 6584 kB Writeback: 0 kB AnonPages: 101832 kB Mapped: 20440 kB Slab: 255360 kB PageTables: 1760 kB NFS_Unstable: 0 kB Bounce: 0 kB CommitLimit: 3130224 kB Committed_AS: 306204 kB VmallocTotal: 114680 kB VmallocUsed: 3708 kB VmallocChunk: 110860 kB HugePages_Total: 0 HugePages_Free: 0 HugePages_Rsvd: 0 Hugepagesize: 4096 kB

As you can see, my current Linux system has 2 GB RAM, with all the additional memory information shown there.

Читайте также:  Path in linux shell

Summary: Linux processor and memory commands

I hope these Linux processor and memory commands have been helpful. When you have some spare time, take a look at the /proc filesystem on your Linux system for other system information you can find, including /proc/loadavg , /proc/vmstat , and much more.

Источник

How To Monitor Your CPU and RAM in Linux

Monitor Your CPU and RAM in Linux

Whether we’re using a Raspberry Pi or a data center server, we need to know how our CPU and RAM are performing and, in Linux, there are a plethora of commands and applications that we can use. At the basic low level “How much RAM have I used?” to inspecting the CPU for vulnerabilities such as Spectre, there are commands at our disposal.

We are going to look at a number of different ways to get RAM and CPU data in the terminal, before we finally look at two applications which can provide a basic level of assurance, at a glance.

These commands will work on most Linux machines. Our test PC ran Kubuntu 21.10 but we are also certain that you can also run through this how-to on a Raspberry Pi. All of the how-to is performed via the Terminal.

How to Check Your CPU in Linux

1. Open a terminal.

2. Use the cat command to display the data held in /proc/cpuinfo.

This command will produce a lot of text, typically it will repeat the same information for the number of cores present in your CPU.

A more concise means to get most of this information is via lscpu, a command that lists the CPU details.

1. Open a terminal.

2. Use lscpu to display the CPU details. The command is quite verbose and we can easily see the number of CPU cores, minimum and maximum CPU speed and the CPU architecture.

Using a little grep magic we can pull out just the information that we need.

Читайте также:  Skype linux связка ключей

1. Open a terminal.

2. Using a vertical pipe, send the output of the lscpu command to grep and search for “max”. This will give us the maximum possible CPU speed. Pipes are a way to send the output of one command as the input for another. Classic examples are piping the output of a command to a text file for later review.

Another means to get CPU information is using dmidecode, a command that dumps the DMI (SMBIOS) contents into something we can understand.

1. Open a terminal.

2. Type in the dmidecode command using sudo, and the argument -t 4. There are many DMI types, with a numerical reference used to pull information for that component. In this case -t 4 is for the CPU. We can replace the 4 with processor for the same effect.

How to Check Your RAM in Linux

1. Open a terminal window.

2. Use the free command. This will show the available memory, and how the memory has been allocated, in Kilobytes.

3. Use the -m switch to show the available memory in Megabytes, or -g for Gigabytes.

Alternatively use the -h switch to show the memory information scaled to the three shortest digits. Giving us at a glance information.

There is a similar way to /proc/cpuinfo for memory information.

1. Open a terminal window.

2. Use the cat command to print the contents of /proc/meminfo. The output is incredibly verbose and can prove useful for debug. In general use we would stick with free -m.

If we need to know the timings and breakdown of memory modules in a machine then we can use lshw.

1. Open a terminal window.

2. Using sudo, issue the lshw command with the -short switch (the device tree) and -C with the class memory.

We can also use dmidecode for a more detailed query.

Information at a Glance

Should we need a more general level of information, our current CPU speed, RAM usage, network bandwidth then we have two commands which can be installed.

How to Install and Use Htop

The standard top command is great, but htop is a much better alternative. Htop provides us with an interactive list of running processes.

1. Open a terminal window.

2. Update your list of repositories.

3. Install htop using apt.

4. Run htop.

At the top of the window we can see the utilization of our CPU cores, under that is our RAM, and finally is the swap.

Читайте также:  Подключиться через ком порт linux

We can scroll through the list with our cursor keys or search using F3 followed by the name of a process or application. Here we have searched for the GNU Image Manipulation Program (GIMP). We can kill the app by pressing F9.

To close htop, press F10.

How to Install and Use Bpytop

Our personal preference is bpytop, a Python implementation of htop but with much more to offer.

1. Open a terminal window.

2. Install bpytop using the Python package manager pip.

3. Run bpytop from the terminal.

Bpytop’s interface is split into a series of areas.

1. CPU Status
a. CPU Speed
b. Core utilization
c. Overall utilization

2. RAM Usage
a. Total RAM
b. Used RAM
c. Available RAM
d. Cache

3. Disk / Storage Usage
a. Used and free space on all mounted devices

4. Network Interface Usage
a. Up and down speeds

5. Processes (just like htop)
a. Process management

We can show or hide an area by pressing the corresponding number (1..4). If we just wanted CPU, RAM, storage and Network information then we press 4. To bring it back, press 4 again.

To filter the processes for a particular application.

1. Press f to filter. It has to be lower case f.

2. Type in the application / process name / Pid. The search will adapt to show the process, in our case GIMP.

3. Press T to terminate the process, or K to kill. These have to be upper case T and K.

To exit bpytop press q at any time.

Stay on the Cutting Edge

Join the experts who read Tom’s Hardware for the inside track on enthusiast PC tech news — and have for over 25 years. We’ll send breaking news and in-depth reviews of CPUs, GPUs, AI, maker hardware and more straight to your inbox.

By submitting your information you agree to the Terms & Conditions and Privacy Policy and are aged 16 or over.

Les Pounder is an associate editor at Tom’s Hardware. He is a creative technologist and for seven years has created projects to educate and inspire minds both young and old. He has worked with the Raspberry Pi Foundation to write and deliver their teacher training program «Picademy».

Источник

Оцените статью
Adblock
detector