It is said that mastering no more than 10% of these Linux commands

01Command to check Linux system version

(3 methods)

  • cat /etc/issue

This command also works on all Linux distributions

 [root@S-CentOS home]# cat /etc/issue
  CentOS release 6.5 (Final)
  Kernel \r on an \m
  • cat /etc/redhat-release

This method is only suitable for Redhat-based Linux

[root@S-CentOS home]# cat /etc/redhat-release

  CentOS release 6.5 (Final)
  • lsb_release -a

All version information can be listed

  [root@S-CentOS ~]# lsb_release -a

  LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch

  Distributor ID:CentOS

02 Check Linux kernel version command

(two methods)

  • cat /proc/version

  • uname -a

1. Linux CPU size

  cat /proc/cpuinfo |grep "model name" && cat /proc/cpuinfo |grep "physical id"

picture

Note: Under Linux, you can see the detailed information of each CPU in /proc/cpuinfo. But for dual-core CPUs, you will see two CPUs in cpuinfo. People often mistake them for two single-core CPUs.

In fact, single-core and dual-core should be distinguished by Physical Processor ID. The Physical Processor ID can be found from cpuinfo or dmesg. Flags If there is ht, it indicates that hyper-threading technology is supported. To determine the number of physical CPUs, you can check the value of physical id. If they are the same,

2. Memory size

cat /proc/meminfo |grep MemTotal

picture

3. Hard drive size

fdisk -l |grep Disk

picture

4、uname -a 

# Linux system information command to view kernel/operating system/CPU information

picture

5、head -n 1 /etc/issue 

# Check the operating system version, it is the number 1 not the letter L

picture

6、cat /proc/cpuinfo 

#Linux system information command to view CPU information

picture

picture

7、hostname 

# View the linux system information command of the computer name

picture

8、lspci -tv 

# List all PCI devices

picture

9、lsusb -tv 

# List the linux system information command of all USB devices

picture

10、lsmod 

# List loaded kernel modules

11、env 

# View environment variable resources

12、free -m 

# Check memory usage and swap area usage

picture

13、df -h 

# Check the usage of each partition

picture

The firewall will restrict the port to only virtual machine graphics operations:

firewall-cmd --state View firewall status

firewall-cmd --get-active-zones lists the domains currently used by the system

firewall-cmd --get-default-zone View the default firewall effective zone

firewall-cmd --get-zones view default rules

firewall-cmd --list-all-zones view all domains

firewall-cmd --zone=public --list-all View information in the public domain

firewall-cmd --get-services lists services represented by names in the system

firewall-cmd --set-default-zone=dmz Set the default zone

[root@client Desktop]# yum install firewalld firewalld-config 安装

picture

[root@client Desktop]# firewall-config will open the interface directly

[root@client Desktop]# systemctl stop iptables 关闭iptables

[root@client Desktop]# systemctl disable iptables automatically shuts down at boot

[root@client Desktop]# systemctl start firewalld Open the firewall

[root@client Desktop]# systemctl enable firewalld automatically starts at boot

[root@client Desktop]# yum search iptables Find the iptables installation package

[root@client Desktop]# yum install iptables-services.x86_64 installation

firewall-cmd --state View firewall status

running

[root@client Desktop]# firewall-cmd --get-active-zones List the domains currently used by the system

ROLE

sources: 172.25.0.252/32

public

interfaces: eth0

[root@client Desktop]# firewall-cmd --get-default-zone View the default firewall effective zone

public

[root@client Desktop]# firewall-cmd --get-zones View the default rules

ROL block dmz drop external home internal public trusted work

picture

14. du -sh # Check the size of the specified directory

15. grep MemTotal /proc/meminfo # Check the total memory

16. grep MemFree /proc/meminfo # Check the amount of free memory

17. uptime # Check the system running time, number of users, and load

18. cat /proc/loadavg # View system load disks and partitions

19. mount | column -t # Check the status of the mounted partition

20. fdisk -l # View all partitions

21. swapon -s # View all swap partitions

22. hdparm -i /dev/hda # View disk parameters (only applicable to IDE devices)

23. dmesg | grep IDE # Check the IDE device detection status network at startup

24. ifconfig # View the properties of all network interfaces

25. iptables -L # View firewall settings

26. route -n # View routing table

27. netstat -lntp # View all listening ports

28. netstat -antp # View all established connections

29. netstat -s # View network statistics process

30. ps -ef # View all processes

31. top # Real-time display of process status users

32. w # View active users

33. id # View specified user information

34. last # View user login log

35. cut -d: -f1 /etc/passwd # View all users of the system

36. cut -d: -f1 /etc/group # View all groups in the system

37. crontab -l # View the current user’s scheduled task services

38. chkconfig –list # List all system services

39. chkconfig –list | grep on # List all started system service programs

40. rpm -qa # View all installed software packages

41. cat /proc/cpuinfo: Linux system command to view CPU related parameters

42. cat /proc/partitions: system information command to view Linux hard disk and partition information

43. cat /proc/meminfo: Linux system command to view memory information of Linux system

44. cat /proc/version: View version, similar to uname -r

45. cat /proc/ioports: View device io port

46. ​​cat /proc/interrupts: View interrupts

47. cat /proc/pci: View pci device information

48. cat /proc/swaps: View information about all swap partitions

picture

RedHat

  • View system release version

[root@getlnx05 ~]# cat /etc/issue

Red Hat Enterprise Linux Server release 5.7 (Tikanga)

Kernel \r on an \m

Related information can also be found through cat /etc/redhat-release.

  • Check the system kernel version and bit number

[root@getlnx05 ~]# lsb_release -a

LSB Version:    :core-4.0-amd64:core-4.0-ia32:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-ia32:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-ia32:printing-4.0-noarch

Distributor ID: RedHatEnterpriseServer

Description:    Red Hat Enterprise Linux Server release 5.7 (Tikanga)

Release:        5.7

Codename:      Tikanga

The LSB Version item displays the kernel version of the system, where amd64 indicates that the system is 64-bit.

CentOS

  • Check the system release version cat /etc/issue

[chenyurong@localhost local]$ cat /etc/issue

CentOS release 6.5 (Final)

Kernel \r on an \m

The same information can also be queried through cat /etc/centos-release.

  • Check the system kernel version and number of bits more /proc/version

[chenyurong@localhost local]$ cat /proc/version

Linux version 2.6.32-431.el6.x86_64 ([email protected]) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC) ) #1 SMP Fri Nov 22 03:15:09 UTC 2013

Linux version 2.6.32-431.el6.x86_64 shows the Linux version, and x86_64 shows the 64-bit system. Relevant information can also be found through uname -r.

Oracle Linux

  • View system release version

[root@DB-Server ~]# cat /etc/issue

Oracle Linux Server release 5.7

Kernel \r on an \m

Relevant information can also be queried through cat /etc/oracle-release.

  • Check the system kernel version and bit number

[root@DB-Server ~]# lsb_release -a

LSB Version:    :core-4.0-amd64:core-4.0-ia32:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-ia32:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-ia32:printing-4.0-noarch

Distributor ID: EnterpriseEnterpriseServer

Description:    Enterprise Linux Enterprise Linux Server release 5.7 (Carthage)

Release:        5.7

Codename:      Carthage

LSB Version displays the kernel version of the system, where amd64 indicates that the system is 64-bit.

Summary of the scope of application of all commands

  • View system release version

picture

  • View system kernel bits

picture

Finally: The complete software testing video tutorial below has been compiled and uploaded. Friends who need it can get it by themselves [guaranteed 100% free]

Software Testing Interview Document

We must study to find a high-paying job. The following interview questions are the latest interview materials from first-tier Internet companies such as Alibaba, Tencent, Byte, etc., and some Byte bosses have given authoritative answers. After finishing this set I believe everyone can find a satisfactory job based on the interview information.

Guess you like

Origin blog.csdn.net/AI_Green/article/details/133323168