Linux query system version

Pioneer of code farmers 2021-01-21 08:14:29
linux query version

1.uname -a (Linux Check the kernel information of the current operating system )

img /proc/version (Linux View the current operating system version information )

img /etc/issue or cat /etc/redhat-release(Linux View the current operating system release information )

img /proc/cpuinfo

lscpu (Linux see cpu Related information , Including models 、 Main frequency 、 Kernel information, etc )


5.getconf LONG_BIT (Linux View Version Description current CPU Running on the 32bit In mode , But it does not represent. CPU I won't support it 64bit)


6.hostname ( Check the server name )

img /etc/sysconfig/network-scripts/ifcfg-eth0

cat /etc/sysconfig/network-scripts/ifcfg-l0

ifconfig ( View network information )


8.lsblk ( View disk information - List information about all available block devices , And it shows the dependency between them , But it doesn't list RAM Disk information )

fdisk -l ( Observe the physical use of the hard disk , You can also partition the hard disk )

df -k ( Used to display the available disk space on the partition )



----------------------------------------------------------------------------- Gorgeous dividing line ----------------------------------------------------------------------------------


【 attach 】 System information query

# uname -a # View kernel / operating system /CPU Information # head -n 1 /etc/issue # View operating system version # cat /proc/cpuinfo # see CPU Information # hostname # View computer name # lspci -tv # List all PCI equipment # lsusb -tv # List all USB equipment # lsmod # List loaded kernel modules # env # View environment variable resources # free -m # View memory usage and swap usage # df -h # View the usage of each partition # du -sh < Directory name > # View the size of the specified directory # grep MemTotal /proc/meminfo # View total memory # grep MemFree /proc/meminfo # View the amount of free memory # uptime # View system running time 、 The number of users 、 load # cat /proc/loadavg # View system load disks and partitions # mount | column -t # View attached partition status # fdisk -l # View all sections # swapon -s # View all swap partitions # hdparm -i /dev/hda # View disk parameters ( Only applicable to IDE equipment ) # dmesg | grep IDE # View on startup IDE Device detection status network # ifconfig # View properties of all network interfaces # iptables -L # View firewall settings # route -n # View 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 user # id < user name > # View specified user information # last # View user login log # cut -d: -f1 /etc/passwd # View all users of the system # cut -d: -f1 /etc/group # View all groups in the system # crontab -l # View the scheduled task service for the current user # chkconfig –list # List all system services # chkconfig –list | grep on # List all started system services

# rpm -qa # View all installed packages

see /proc/uptime File computing system start time : cat /proc/uptime Output : 5113396.94 575949.85

The first number is the time the system has been running 5113396.94 second , Use system tools date The system start-up time can be calculated

date -d "$(awk -F. '{print $1}' /proc/uptime) second ago" +"%Y-%m-%d %H:%M:%S"

Output : 2018-01-02 06:50:52

see /proc/uptime File computing system run time

cat /proc/uptime| awk -F. '{run_days= 1 / 86400 ; r u n h o u r = ( 1 / 86400;run_hour=( 1 % 86400)/3600;run_minute=( 1 1 % 3600)/60;run_second= 1 % 60;printf(" The system is running :%d God %d when %d branch %d second ",run_days,run_hour,run_minute,run_second)}'

Output : The system is running :1 God 1 when 36 branch 13 second

Linux View physics CPU Number 、 Check the number 、 Logic CPU Number

# Total number of cores = Physics CPU Number X Every physics CPU The number of nuclear # General logic CPU Count = Physics CPU Number X Every physics CPU The number of nuclear X Number of hyper threads

# View physics CPU Number cat /proc/cpuinfo| grep "physical id"| sort| uniq| wc -l 2

# View each physical CPU in core The number of ( Nuclear number ) cat /proc/cpuinfo| grep "cpu cores"| uniq cpu cores : 2

# View logic CPU The number of cat /proc/cpuinfo| grep "processor"| wc -l

# see CPU Information ( model ) cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c 4 Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz

Enter the command cat /proc/cpuinfo see physical id There are just a few physics cpu; see processor If there are several, there will be several logics cpu. ( One ) Concept ① Physics CPU actual Server On the middle slot CPU Number Physics cpu Number , It can be counted without repetition physical id There are several ② Logic CPU /proc/cpuinfo Used to store cpu Hardware information The content of the message lists processor 0 –processor n Specifications . Here we need to pay attention to ,n+1 It's logic cpu Count General situation , We think of a cpu It can be multi-core , add intel Hyper threading technology (HT), You can logically double the number of cpu core come out Logic CPU Number = Physics cpu Number x cpu cores This specification is worth x 2( If supported and turned on ht)
Note the :Linux Next top Viewed CPU It's also logic CPU Number ③ CPU Check the number A piece of CPU The number of chipsets on which data can be processed 、 Like the present i5 760, It's dual core four thread CPU、 and i5 2250 Four core and four thread CPU Generally speaking , Physics CPU Number × Each core should be equal to logic CPU The number of , If not equal , Is the server's CPU Support hyper threading technology

lscpu command , Check out cpu Statistical information


Overview view memory free -m The details of :cat /proc/meminfo

View hard disk and partition distribution : lsblk

If you want to see the details of hard disk and partition :fdisk -l

Use “df -k” command , With KB Displays disk usage and utilization in units ,-m in M Displays disk usage and utilization in units

network card

Check the 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)

Check all network interfaces of the system :ifconfig -a

If you want to see the details of a network interface , for example eth0 Detailed parameters and indicators of :ethtool eth0

see pci Information , That is, all hardware slot information of the motherboard :lspci

If you want more details :lspci -v perhaps lspci -vv

If you want to see the device tree :lspci -t

Linux /proc Catalog details

\1. /proc Catalog Linux The kernel provides a way to /proc file system , Access the internal data structure of the kernel at runtime 、 The mechanism for changing kernel settings .proc File system is a pseudo file system , It's only in memory , It doesn't take up external storage space . It provides the interface for the operation of accessing the system kernel data in the way of file system . Users and applications can use proc Get information about the system , And can change some parameters of the kernel . Because of the information of the system , Like the process , It's dynamic , So users or applications read proc When you file ,proc The file system dynamically reads the required information from the system kernel and submits it . The files or subfolders listed below , It's not all in your system , It depends on your kernel configuration and the modules loaded . in addition , stay /proc There are three other important directories :net,scsi and sys. Sys The catalog is writable , It can be used to access or modify kernel parameters , and net and scsi It depends on the kernel configuration . for example , If the system does not support scsi, be scsi directory does not exist . In addition to the above , There are also directories named after numbers , They are process directories . Every process currently running in the system has a corresponding directory in /proc Next , In progress PID The number is the directory name , They are interfaces for reading process information . and self Directory is the information interface of the read process itself , It's a link.

\2. Sub file or sub folder /proc/buddyinfo Every... In every memory area order How many pieces are available , It's about memory fragmentation /proc/cmdline Pass to at startup kernel Parameter information of /proc/cpuinfo cpu Information about /proc/crypto All installed encryption passwords and details used by kernel /proc/devices Devices already loaded and categorized /proc/dma Registered to use ISA DMA Channel list /proc/execdomains Linux The kernel currently supports execution domains /proc/fb Frame buffer device list , Including quantity and controlling its drive /proc/filesystems The file system types currently supported by the kernel /proc/interrupts x86 Every... In the architecture IRQ Number of interruptions /proc/iomem The current mapping of each physical device in system memory /proc/ioports The range of registered ports used for input and output of a device /proc/kcore Represents the physical memory of the system , Store in core file format , It shows the number of bytes , be equal to RAM Size plus 4kb /proc/kmsg Record the information generated by the kernel , Can pass /sbin/klogd or /bin/dmesg To deal with it /proc/loadavg According to the past period of time CPU and IO The state of the load resulting from , And uptime The order is about /proc/locks List of files locked by kernel /proc/mdstat Multiple hard disks ,RAID Configuration information (md=multiple disks) /proc/meminfo RAM Information about use /proc/misc Other major equipment ( The equipment number is 10) The driver registered on /proc/modules A list of all modules loaded into the kernel /proc/mounts All mounts used in the system /proc/mtrr system-used Memory Type Range Registers (MTRRs) /proc/partitions Block allocation information in the partition /proc/pci In the system PCI The equipment list /proc/slabinfo All active in the system slab Cache information /proc/stat be-all CPU Event information /proc/sysrq-trigger Use echo When the command came to write this file , long-range root Users can execute most of the system request critical commands , It's like executing on a local terminal . To write this file , Need to put /proc/sys/kernel/sysrq Cannot be set to 0. This document is right root It's also unreadable /proc/uptime How long has the system been running /proc/swaps Use of swap space /proc/version Linux Kernel version and gcc edition /proc/bus The system bus (Bus) Information , for example pci/usb etc. /proc/driver Driver information /proc/fs File system information /proc/ide ide Equipment information /proc/irq Interrupt request device information /proc/net Network card device information /proc/scsi scsi Equipment information /proc/tty tty Equipment information /proc/net/dev Display network adapter and Statistics /proc/vmstat Virtual memory statistics /proc/vmcore kernel panic Memory image of /proc/diskstats Get disk information /proc/schedstat kernel Scheduler Statistics /proc/zoneinfo Display memory space statistics , Useful for analyzing virtual memory behavior

Here are /proc Process in directory N Information about /proc/N pid by N Process information /proc/N/cmdline Process start command /proc/N/cwd Link to the current working directory of the process /proc/N/environ List of process environment variables /proc/N/exe Link to the process's execution command file /proc/N/fd Contains all process related file descriptors /proc/N/maps Memory mapping information related to the process /proc/N/mem Refers to the memory held by the process , Do not read /proc/N/root Link to the root of the process /proc/N/stat State of process /proc/N/statm The state of the memory used by the process /proc/N/status Process status information , Than stat/statm More readable /proc/self Link to the currently running process

That's all Liangxu tutorial website For all of you Linux Related knowledge .

本文为[Pioneer of code farmers]所创,转载请带上原文链接,感谢

  1. 【计算机网络 12(1),尚学堂马士兵Java视频教程
  2. 【程序猿历程,史上最全的Java面试题集锦在这里
  3. 【程序猿历程(1),Javaweb视频教程百度云
  4. Notes on MySQL 45 lectures (1-7)
  5. [computer network 12 (1), Shang Xuetang Ma soldier java video tutorial
  6. The most complete collection of Java interview questions in history is here
  7. [process of program ape (1), JavaWeb video tutorial, baidu cloud
  8. Notes on MySQL 45 lectures (1-7)
  9. 精进 Spring Boot 03:Spring Boot 的配置文件和配置管理,以及用三种方式读取配置文件
  10. Refined spring boot 03: spring boot configuration files and configuration management, and reading configuration files in three ways
  11. 精进 Spring Boot 03:Spring Boot 的配置文件和配置管理,以及用三种方式读取配置文件
  12. Refined spring boot 03: spring boot configuration files and configuration management, and reading configuration files in three ways
  13. 【递归,Java传智播客笔记
  14. [recursion, Java intelligence podcast notes
  15. [adhere to painting for 386 days] the beginning of spring of 24 solar terms
  16. K8S系列第八篇(Service、EndPoints以及高可用kubeadm部署)
  17. K8s Series Part 8 (service, endpoints and high availability kubeadm deployment)
  18. 【重识 HTML (3),350道Java面试真题分享
  19. 【重识 HTML (2),Java并发编程必会的多线程你竟然还不会
  20. 【重识 HTML (1),二本Java小菜鸟4面字节跳动被秒成渣渣
  21. [re recognize HTML (3) and share 350 real Java interview questions
  22. [re recognize HTML (2). Multithreading is a must for Java Concurrent Programming. How dare you not
  23. [re recognize HTML (1), two Java rookies' 4-sided bytes beat and become slag in seconds
  24. 造轮子系列之RPC 1:如何从零开始开发RPC框架
  25. RPC 1: how to develop RPC framework from scratch
  26. 造轮子系列之RPC 1:如何从零开始开发RPC框架
  27. RPC 1: how to develop RPC framework from scratch
  28. 一次性捋清楚吧,对乱糟糟的,Spring事务扩展机制
  29. 一文彻底弄懂如何选择抽象类还是接口,连续四年百度Java岗必问面试题
  30. Redis常用命令
  31. 一双拖鞋引发的血案,狂神说Java系列笔记
  32. 一、mysql基础安装
  33. 一位程序员的独白:尽管我一生坎坷,Java框架面试基础
  34. Clear it all at once. For the messy, spring transaction extension mechanism
  35. A thorough understanding of how to choose abstract classes or interfaces, baidu Java post must ask interview questions for four consecutive years
  36. Redis common commands
  37. A pair of slippers triggered the murder, crazy God said java series notes
  38. 1、 MySQL basic installation
  39. Monologue of a programmer: despite my ups and downs in my life, Java framework is the foundation of interview
  40. 【大厂面试】三面三问Spring循环依赖,请一定要把这篇看完(建议收藏)
  41. 一线互联网企业中,springboot入门项目
  42. 一篇文带你入门SSM框架Spring开发,帮你快速拿Offer
  43. 【面试资料】Java全集、微服务、大数据、数据结构与算法、机器学习知识最全总结,283页pdf
  44. 【leetcode刷题】24.数组中重复的数字——Java版
  45. 【leetcode刷题】23.对称二叉树——Java版
  46. 【leetcode刷题】22.二叉树的中序遍历——Java版
  47. 【leetcode刷题】21.三数之和——Java版
  48. 【leetcode刷题】20.最长回文子串——Java版
  49. 【leetcode刷题】19.回文链表——Java版
  50. 【leetcode刷题】18.反转链表——Java版
  51. 【leetcode刷题】17.相交链表——Java&python版
  52. 【leetcode刷题】16.环形链表——Java版
  53. 【leetcode刷题】15.汉明距离——Java版
  54. 【leetcode刷题】14.找到所有数组中消失的数字——Java版
  55. 【leetcode刷题】13.比特位计数——Java版
  56. oracle控制用户权限命令
  57. 三年Java开发,继阿里,鲁班二期Java架构师
  58. Oracle必须要启动的服务
  59. 万字长文!深入剖析HashMap,Java基础笔试题大全带答案
  60. 一问Kafka就心慌?我却凭着这份,图灵学院vip课程百度云