Home>Article>Operation and Maintenance> How to check version information in linux
How to check version information in Linux: 1. Check the current operating system kernel information through the "uname -a" command; 2. Check the current operating system version information through the "cat /proc/version" command; 3. Use "cat /etc/issue" or "cat /etc/redhat-release" to check the current operating system release information; 4. Use the "cat /proc/cpuinfo" command to check CPU-related information, etc.
The operating environment of this tutorial: linux7.5.1804 system, Dell G3 computer.
How to check version information in Linux?
Linux View basic system information, version information (most complete version)
View version information under Linux, including number of digits, Version information, CPU kernel information, and specific CPU model
1.uname -a (Linux view version of the current operating system kernel information)
2 .cat /proc/version (Linux to view the current operating system version information)
3.cat /etc/issue or cat /etc/redhat-release (Linux to view the current version Operating system release information)
4.cat /proc/cpuinfo
lscpu (Linux view cpu related information, including model, frequency, kernel information etc.)
5.getconf LONG_BIT (Linux check the version description. The current CPU is running in 32bit mode, but it does not mean that the CPU does not support 64bit)
6.hostname (View server name)
##7.cat /etc/sysconfig/network-scripts/ifcfg-eth0 cat /etc/sysconfig/network-scripts/ifcfg-l0 ifconfig (View network information)##8.lsblk (View disk information - column Displays information about all available block devices and the dependencies between them, but it does not list RAM disk information)
fdisk -l (Observe the physical usage of the hard disk, and also check the hard disk Partition)
df -k (used to display the available disk space on the disk partition)
---------- ---------------------------------- Gorgeous dividing line ---------- ----------------------------
uname -a # View kernel/operating system/CPU information
# head -n 1 / etc/issue # Check the operating system version
# cat /proc/cpuinfo # Check the CPU information
# hostname # Check the computer name
# lspci -tv # List all PCI devices
# lsusb -tv # List all USB devices
# lsmod # List loaded kernel modules
# env # View environment variable resources
# free -m # View memory usage and swap area usage
# df -h # Check the usage of each partition
# du -sh
# grep MemTotal /proc/meminfo # Check the total memory
# grep MemFree /proc /meminfo # Check the amount of free memory
# uptime # Check the system running time, number of users, load
# cat /proc/loadavg # Check the system load disk and partition
# mount | column -t # Check the mount Connected partition status
# fdisk -l # View all partitions
# swapon -s # View all swap partitions
# hdparm -i /dev/hda # View disk parameters (only applicable to IDE devices)
# dmesg | grep IDE # Check the network status of IDE device detection at startup
# ifconfig # Check the properties of all network interfaces
# iptables -L # Check the firewall settings
# route -n # Check the routing table
# netstat -lntp # View all listening ports
# netstat -antp # View all established connections
# netstat -s # View network statistics process
# ps -ef # View all processes
# top # Real-time display of process status users
# w # View active users
# id
# last # View user login log
# cut -d: -f1 /etc/passwd # View all users in the system
# cut -d: -f1 /etc/group # View all groups in the system
# crontab -l # View scheduled task services for the current user
# chkconfig –list # List all system services
# chkconfig –list | grep on # List all started system service programs
# rpm -qa # View all installed software packages
View the /proc/uptime file to calculate the system startup time:
cat /proc/uptime
Output: 5113396.94 575949.85
The first number is the system running time 5113396.94 seconds, use The system tool date can calculate the system startup time
date -d "$(awk -F. '{print $1}' /proc/uptime) second ago" "%Y-%m-%d %H :%M:%S"
Output: 2018-01-02 06:50:52
View the /proc/uptime file to calculate the system running time
cat /proc /uptime| awk -F. '{run_days=$1 / 86400;run_hour=($1 % 86400)/3600;run_minute=($1 % 3600)/60;run_second=$1 % 60;printf("The system is running: %d Day %d hour %d minute %d second",run_days,run_hour,run_minute,run_second)}'
Output: The system has been running: 1 day 1 hour 36 minutes 13 seconds
# Total number of cores = Number of physical CPUs X Number of cores per physical CPU
# Total number of logical CPUs = Number of physical CPUs
# Check the number of cores in each physical CPU (i.e. the number of cores)
cat /proc/cpuinfo| grep "cpu cores"| uniq
# Check the number of logical CPUs
cat /proc/cpuinfo| grep "processor"| wc -l
# Check the CPU information (model)
cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c
Enter the command cat /proc/cpuinfo to check how many physical ids there are There are several physical CPUs per one; there are several logical CPUs based on the number of processors.
(1) Concept
The number of CPUs on the slot in the actual server
The number of physical CPUs, you can count the number of non-duplicate physical ids
② Logical CPU
/proc/cpuinfo is used to store cpu hardware information.
The information content lists the specifications of processor 0 –processor n respectively. It should be noted here that n 1 is the number of logical CPUs
Generally speaking, we believe that a CPU can have multiple cores, and with Intel's Hyper-Threading Technology (HT), it can be logically divided into twice the number of CPU cores
The number of logical CPUs = the number of physical CPUs # The number of chipsets that can process data on a CPU. For example, the current i5 760 is a dual-core and four-thread CPU, while the i5 2250 is a four-core and four-thread CPU.
Generally speaking, the number of physical CPUs × each The number of cores should be equal to the number of logical CPUs. If they are not equal, it means that the server's CPU supports hyper-threading technology
lscpu command, you can view the statistical information of the CPU
Memory
Check the memory status in summary free -m Details: cat /proc/meminfo
Check the hard disk and partition distribution: lsblk
If you want to see the detailed information of the hard disk and partition: fdisk -l
Use the "df -k" command to display disk usage and occupancy in KB units, -m displays disk usage and occupancy in M units
Network card
View network card hardware information
# lspci | grep -i 'eth'
02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 06)
View all network interfaces of the system: ifconfig -a
If you want to view the detailed information of a certain network interface, such as the detailed parameters and indicators of eth0: ethtool eth0
View pci information, that is, all hardware slot information on the motherboard: lspci
If you want more detailed information: lspci -v or lspci -vv
If you want to see the device tree: lspci -t
1. /proc directory
The Linux kernel provides a way to run through the /proc file system. A mechanism for accessing kernel internal data structures and changing kernel settings. The proc file system is a pseudo file system that only exists in memory and does not occupy external memory space. It provides an interface for accessing system kernel data in the form of a file system.
Users and applications can obtain system information through proc and change some parameters of the kernel. Since system information, such as processes, changes dynamically, when a user or application reads a proc file, the proc file system dynamically reads the required information from the system kernel and submits it. Not all of the files or subfolders listed below may exist on your system, depending on your kernel configuration and loaded modules. In addition, there are three very important directories under /proc: net, scsi and sys. The Sys directory is writable and can be used to access or modify kernel parameters, while net and scsi depend on the kernel configuration. For example, if the system does not support scsi, the scsi directory does not exist.
In addition to the ones introduced above, there are also some directories named with numbers, which are process directories. Each process currently running in the system has a corresponding directory under /proc, with the PID number of the process as the directory name. They are the interfaces for reading process information. The self directory is the information interface for reading the process itself, which is a link.
2. Sub-files or sub-folders
/proc/buddyinfo How many blocks are available for each order in each memory area, which is related to memory fragmentation issues
/proc/cmdline is passed to the kernel at startup Parameter information
/proc/cpuinfo cpu information
/proc/crypto All installed encryption passwords and details used by the kernel
/proc/devices Loaded devices and classification
/proc/dma List of registered ISA DMA channels
/proc/execdomains Execution domains currently supported by the Linux kernel
/proc/fb List of frame buffer devices, including the number and the driver that controls it
/proc/filesystems Kernel current Supported file system types
/proc/interrupts The number of interrupts per IRQ in x86 architecture
/proc/iomem The current mapping of each physical device in system memory
/proc/ioports The input of a device The registered port range used for output
/proc/kcore represents the physical memory of the system and is stored in core file format. The number of bytes shown inside is equal to the RAM size plus 4kb
/proc/kmsg records kernel generation The information can be processed through /sbin/klogd or /bin/dmesg
/proc/loadavg The load status based on the status of CPU and IO in the past period of time is related to the uptime command
/proc/locks List of files locked by the kernel
/proc/mdstat Multiple hard disks, RAID configuration information (md=multiple disks)
/proc/meminfo RAM usage related information
/proc/misc Other major devices (devices Driver number 10)
/proc/modules List of all modules loaded into the kernel
/proc/mounts All mounts used in the system
/proc/mtrr Memory Type Range Registers used by the system (MTRRs)
/proc/partitions Block allocation information in the partition
/proc/pci PCI device list in the system
/proc/slabinfo All active slab cache information in the system
/proc/ stat All CPU activity information
/proc/sysrq-trigger When using the echo command to write this file, the remote root user can execute most system request key commands as if executed in the local terminal. To write to this file, /proc/sys/kernel/sysrq must not be set to 0. This file is also unreadable by root
/proc/uptime How long the system has been running
/proc/swaps Swap space usage
/proc/version Linux kernel version and gcc version
/proc /bus system bus (Bus) information, such as pci/usb, etc.
/proc/driver driver information
/proc/fs file system information
/proc/ide ide device information
/proc/irq Interrupt request device information
/proc/net Network card device information
/proc/scsi scsi device information
/proc/tty tty device information
/proc/net/dev Display network adapter and statistical information
/proc/vmstat Virtual memory statistics
/proc/vmcore Memory image when kernel panic
/proc/diskstats Obtain disk information
/proc/schedstat Kernel scheduler statistics
/ proc/zoneinfo displays the statistical information of the memory space, which is useful for analyzing virtual memory behavior
The following is the information of process N in the /proc directory
/proc/N Process information with pid N
/ proc/N/cmdline Process startup command
/proc/N/cwd Link to the current working directory of the process
/proc/N/environ Process environment variable list
/proc/N/exe Link to the execution of the process Command file
/proc/N/fd contains all file descriptors related to the process
/proc/N/maps Memory mapping information related to the process
/proc/N/mem refers to the process held memory, unreadable
/proc/N/root is linked to the root directory of the process
/proc/N/stat is the status of the process
/proc/N/statm is the status of the memory used by the process
/proc/N/status process status information, more readable than stat/statm
/proc/self links to the currently running process
Recommended study: "Linux Video Tutorial》
The above is the detailed content of How to check version information in linux. For more information, please follow other related articles on the PHP Chinese website!