I am looking for different output of the uname -a command.
The one that I have is
Linux dogeserv.net 5.4.0-89-generic #100-Ubuntu SMP Fri Sep 24 14:50:10 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
I am looking for different outputs of Processor (other then x86_64 and aarch64), OS , -m output.
As per the time i am writing the answer, these options are available in uname command.
-a, --all print all information, in the following order, except omit -p and -i if unknown:
-s, --kernel-name print the kernel name
-n, --nodename print the network node hostname
-r, --kernel-release print the kernel release
-v, --kernel-version print the kernel version
-m, --machine print the machine hardware name
-p, --processor print the processor type (non-portable)
-i, --hardware-platform print the hardware platform (non-portable)
-o, --operating-system print the operating system
For some reason, it's not showing my processor, but you can use uname -p for processor information.
Incase you want detailed information about your processor, you can use cat /proc/cpuinfo, and this will show you information about the processor of your computer with information of every single core and this is what your output should look like
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 142
model name : Intel(R) Core(TM) i3-8130U CPU # 2.20GHz
stepping : 10
microcode : 0xea
cpu MHz : 1279.215
cache size : 4096 KB
physical id : 0
siblings : 4
core id : 0
cpu cores : 2
.....
TO be more specific you can use these commands for their respective outputs
cat /proc/cpuinfo | grep 'vendor' | uniq #view vendor name
cat /proc/cpuinfo | grep 'model name' | uniq #display model name
cat /proc/cpuinfo | grep processor | wc -l #count the number of processing units
cat /proc/cpuinfo | grep 'core id' #show individual cores
A alternative to cat /proc/cpuinfo is lscpu, it will also give you information about your processor, but it will be more about the whole processor instead of every single core.
this is what output should look like:
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Address sizes: 39 bits physical, 48 bits virtual
Byte Order: Little Endian
CPU(s): 4
On-line CPU(s) list: 0-3
Vendor ID: GenuineIntel
BIOS Vendor ID: Intel(R) Corporation
Model name: Intel(R) Core(TM) i3-8130U CPU # 2.20GHz
BIOS Model name: Intel(R) Core(TM) i3-8130U CPU # 2.20GHz
CPU family: 6
Model: 142
Thread(s) per core: 2
Core(s) per socket: 2
.....
Lastly stackoverflow is for mostly programming related questions, you can see all the sites Stack Exchange offers for different type of questions to be asked by clicking this Link
Related
Is it possible to get this counter via procfs/sysfs? That is how many times CPU preempted any active task. Per process value is also OK.
Linux pve-index 4.15.18-5-pve #1 SMP PVE 4.15.18-24 (Thu, 13 Sep 2018 09:15:10 +0200) x86_64 GNU/Linux
If you mean non-voluntary context switches, then there is at least couple files under /proc:
# cat /proc/61115/status | grep ctxt_switches
voluntary_ctxt_switches: 6511
nonvoluntary_ctxt_switches: 143
# cat /proc/61115/sched
bash (61115, #threads: 1)
-------------------------------------------------------------------
...
nr_switches : 6594
nr_voluntary_switches : 6451
nr_involuntary_switches : 143
Just replace number 61115 with the wanted pid.
This question already has answers here:
How to grep for contents after pattern?
(8 answers)
Closed 4 years ago.
I want to grab the cpu model of an android device using
cat /proc/cpuinfo
The output is something like this
Processor : AArch64 Processor rev 3 (aarch64)
processor : 0
processor : 1
processor : 2
processor : 3
processor : 4
processor : 5
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x0
CPU part : 0xd03
CPU revision : 3
Hardware : Qualcomm Technologies, Inc msm8992
Revision : 000b
Now what I need is only the "msm8992". The last 4 numbers change from devices to another, So what I was thinking is to search for word that starts with "msm" and extract it but I am struggling with grep / awk commands.
perhaps search for "Hardware" and extract the last word
$ awk '/^Hardware/{print $NF}' /proc/cpuinfo
grep -oE 'msm[0-9]+' might do as well.
since you tag awk, I used awk for It. Please check it out
grep msm /proc/cpuinfo | awk '{print substr($0, length($0)-6,7)}'
when i set irq for my Ethernet cannot be effective. (irq from 99-119)
$ sudo cat /proc/irq/109/smp_affinity
00,00000400
$ sudo sh -c "echo 0 > /proc/irq/109/smp_affinity"
$ sudo cat /proc/irq/109/smp_affinity
00,00000400
i want to set all ethernet irq to bind with cpu0. but no lucky for me to set it. i am not sure what kind of problems i met.
and i noticed affinity_hint has following value, and i cannot set it anyway.
$sudo cat /proc/irq/109/affinity_hint
00,00000400
$ sudo sh -c "echo 0 > /proc/irq/109/affinity_hint"
sh: line 0: echo: write error: Input/output error
this system i have 2 cpus with 6 cores. and enable hyper thread. totally has 24 cpu cores.
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 40
On-line CPU(s) list: 0-39
Thread(s) per core: 2
Core(s) per socket: 10
Socket(s): 2
NUMA node(s): 2
Vendor ID: GenuineIntel
CPU family: 6
Model: 62
Model name: Intel(R) Xeon(R) CPU E5-2660 v2 # 2.20GHz
Stepping: 4
CPU MHz: 1201.921
BogoMIPS: 4404.51
Virtualization: VT-x
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 25600K
NUMA node0 CPU(s): 0-9,20-29
NUMA node1 CPU(s): 10-19,30-39
please help advise how to resolve. thanks!
You need to specify a bit mask giving a set of CPUs that can handle the interrupt. For CPU0, the mask value is 1.
i have got the solution. i make a mistake here. it should be echo "1" for core 0, and echo "2" for core 1.
I would like to start one kernel thread per CPU with kthread_create()/kthread_bind(). However, I can't for the life of me figure out how to query the number of available CPUs. I did find the CPU_SET man page but that didn't help either.
Any thoughts?
You can use num_online_cpus() to get the number of available cpus. This may be different from things like nr_cpu_ids if the system was booted using a maxcpus setting that is not the same as the number of cpus in the system.
See following link, cpuinfo.c, proc.c, may be help you. And
at line 143, you can use two functions for traversing cpus, cpumask_first, cpumask_next. I think, by try and error, you can find the solutions.
You can use x86info. It's not per default installed (sudo apt-get install x86info (ubuntu))
x86info | grep Found
Found 2 CPUs
another way is:
grep processor /proc/cpuinfo | wc -l
2
Is that you are looking for?
If you're using a system that is Fedora Linux / RHEL / CentOS v6+ / Debian Linux v6+ you can use lscpu:
michael#test:~$ lscpu
Architecture: i686
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 4
On-line CPU(s) list: 0-3
Thread(s) per core: 2
Core(s) per socket: 2
Socket(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 37
Stepping: 5
CPU MHz: 1199.000
BogoMIPS: 5319.88
Virtualization: VT-x
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 3072K
Particularly you might be interested in the -p option which gives you parseable output:
michael#test:~$ lscpu -p
# The following is the parsable format, which can be fed to other
# programs. Each different item in every column has an unique ID
# starting from zero.
# CPU,Core,Socket,Node,,L1d,L1i,L2,L3
0,0,0,,,0,0,0,0
1,0,0,,,0,0,0,0
2,1,0,,,1,1,1,0
3,1,0,,,1,1,1,0
$ nproc --all
4
--all print the number of installed processors
What command should I use to find the processor / chip architecture on Linux?
linux-x86-32
linux-x86-64
linux-ppc-64
To display kernel architecture: uname -p
To display extended CPU details: cat /proc/cpuinfo
In the terminal, type
lscpu
which returns output like this:
Architecture: i686
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 2
On-line CPU(s) list: 0,1
Thread(s) per core: 1
Core(s) per socket: 2
Socket(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 23
Stepping: 6
CPU MHz: 2670.000
BogoMIPS: 5320.13
L1d cache: 32K
L1i cache: 32K
L2 cache: 3072K
To only get the architecture:
lscpu | grep Architecture
Which in this case is
Architecture: i686
See man lscpu for more.
I'm surprised no one suggested uname -m. On my laptop, this gives armv7l, while uname -a gives me a monstrous two lines of text.
see (man uname):
echo `uname -s`-`uname -p`
A concise command producing information about the current machine is hostnamectl. Example output:
Static hostname: xxxx
Icon name: computer-laptop
Chassis: laptop
Boot ID: b3a1f952c514411c8c4xxxxxxxxxxxx
Operating System: Ubuntu 14.04.3 LTS
Kernel: Linux 3.19.0-43-generic
Architecture: x86_64
It gives you the most basic information about your machine. Other commands like uname, lsb_release, or lscpu return more specific information.