To view some basic information about the server:
Linux Basic command: http://cnblogs.com/mmzs/p/8406208.html
Linux some commands not found/unusable: http://www.cnblogs.com/mmzs/p/9043190.html
Displays the installed system version
[Email Protected]_0_5_centos ~]# cat/proc/version
[Email Protected]_0_5_centos ~]# uname-r
how many bits of the system are displayed (32/64bit)
To view all installed packages
// to view all installed packages [Email Protected]_0_5_centos ~]# rpm-QA libX11-devel-1.6.5-1. El7.x86_64xmlrpc- c-client-1.32.5-1905. Svn2451.el7.x86_64setup-2.8.71-7. EL7.NOARCHGTK+-1.2.10-77. el7.x86_ 64dhcp-libs-4.2.5-58. el7.centos.x86_64langtable-data-0.0.31-3. El7.noarchlibxfixes- Devel-5.0.3-1.el7.x86_64
View the configured environment variables
View the configured environment variables
[Email Protected]_0_5_centos ~]# env
View the current user's scheduled tasks service
// View the current user's scheduled tasks service
View the properties of all network interfaces, including IP addresses
// View the properties of all network interfaces, including IP addresses [Email Protected]_0_5_centos ~]# ifconfig
Firewall
CENTOS7 Firewall Related: firewall-cmd-State (firewall status) systemctl list-unit-files| grep firewalld.service (firewall state) Systemctl Restart Firewalld.service (firewall off) systemctl disable Firewalld.service (disable boot automatically)//centos7 the following firewall-related:service iptables Stop (shutdown firewall centos7 below) chkconfig iptables Off (no boot start automatically)
Memory/hard disk size
memory size [[email protected]_0_5_centos ~]# Cat/proc/meminfo | grep memtotalmemtotal: 1883616 kb//HDD size [[email protected]_0_5_centos ~]# fdisk-l | grep diskdisk/dev/vda:53.7 GB, 53687091200 bytes, 104857600 sectorsdisk label Type:dosdisk identifier:0x000c5e30< /c10>
viewing system memory conditions
[[Email protected]_0_5_centos ~]# free total used free Shared buff /cache availablemem: 1883616 875260 67028 388 941328 574040swap: 0 0 0// total: Total physical memory size // used: How much free: How many // // buffers/cached: The size of the disk cache // available: Available physical memory size
// View Total Memory grep memtotal/proc/// View idle amount
CPU Size
// view CPU-related parameters [[Email Protected]_0_5_centos ~]# cat/proc/~]# cat/proc/cpuinfo |grep ' model name ' && cat/proc/cpuinfo |grep "Physical ID"model name : Intel (R) Xeon (r) CPU E5-26xx v4physical ID 0// Description: Detailed information about each CPU can be seen in/proc/cpuinfo under Linux. But for a dual-core CPU, you will see two CPUs in the Cpuinfo. It is often mistaken for a two single-core CPU. // you should actually differentiate between single-core and dual-core by physical Processor ID. The physical Processor ID can be found from Cpuinfo or DMESG. Flags if you have HT description support Hyper-Threading technology determine the number of physical CPUs you can view the value of the physical ID, same as the same CPU
View partition Usage
//View all Partitions[Email protected]_0_5_centos ~]# fdisk-Ldisk/dev/vda:53.7 GB, 53687091200 bytes, 104857600sectorsunits= Sectors of 1 * 512 = 512bytessector size (logical/physical): bytes/512Bytesi/o Size (minimum/optimal): bytes/512bytesdisk label Type:dosdisk identifier:0x000c5e30Device Boot Start End Blocks Id System/DEV/VDA1 * 2048 104857566 52427759+ 83Linux//view the usage of each partition[Email protected]_0_5_centos ~]# DF-hfilesystem Size used Avail use%mounted on/DEV/VDA1 50G 15G 33G 32%/Devtmpfs 911M0 911M 0%/Devtmpfs 920M 24K 920M1%/dev/Shmtmpfs 920M 364K 920M1%/Runtmpfs 920M0 920M 0%/sys/fs/Cgrouptmpfs 184M0 184M 0%/run/user/0
To view the size of a specified directory
// View the size of the specified directory, which is the current directory by default when not specified [Email protected]_0_5_centos ~]# du-sh/software/2.1g /software/
View user Information
[[Email Protected]_0_5_centos ~// View active user [email protected]_0_5_centos ~// View specified user information [[Email protected]_0_5_centos ~// View user log in log [email protected]_0_5_ CentOS ~]# cut-d:-f1/etc/// View system all users [[email Protected]_0_5_centos ~]# cut-d:-f1/etc/< C12>group// View all system groups
Linux System Information command to view CPU information
//Linux System Information command to view CPU information[Email Protected]_0_5_centos ~]# cat/proc/Cpuinfo Processor:0VENDOR_ID:GENUINEINTELCPU Family:6Model:79Model Name:intel (R) Xeon (r) CPU E5-26xx v4stepping:1microcode:0x1CPU MHz:2394.446Cache Size:4096kbphysical ID:0Siblings:1Core ID:0CPU Cores:1Apicid:0Initial apicid:0Fpu:yesfpu_exception:yescpuid Level:13wp:yesflags:fpu vme de PSE TSC MSR PAE MCE cx8 APIC Sep MTRR PGE MCA cmov Pat PSE36 Clflush MMX FXSR SSE SSE2 SS HT syscall NX LM CONSTANT_TSC Rep_good nopl eagerfpu pni pclmulqdq ssse3 FMA cx16 pcid sse4_1 sse4_2 x2apic m OVBE popcnt tsc_deadline_timer AES Xsave AVX f16c rdrand hypervisor lahf_lm ABM 3dnowprefetch bmi1 avx2 bmi2 rdseed ADX xs Aveoptbogomips:4788.89Clflush Size:64cache_alignment:64Address sizes:48 Bits physical,bits Virtualpower Management:
View system run/start time
//The clearest way to view[Email Protected]_0_5_centos ~]# cat/proc/uptime| Awk-f. ' {run_days=$1/86400;run_hour= ($ 86400)/3600;run_minute= ($ 3600)/60;run_second=$1% 60;printf ("system has been running:%d days% D at%d seconds ", Run_days,run_hour,run_minute,run_second)} 'system has been running: 0 days 0:6 7 seconds//Who-b View the last time the system started. //who-r View current system run time[Email Protected]_0_5_centos ~]# Who-B System Boot2018-06-28 16:52//System last Boot time[Email Protected]_0_5_centos ~]# Who-R Run-level 3 2018-06-28 16:52//Last reboot can see when the Linux system history started. After restarting the operating system, then[Email Protected]_0_5_centos ~]# last rebootreboot system boot3.10.0-693.el7.x Thu June 28 16:52-11:21 (3+18:29) reboot system boot3.10.0-693.el7.x Mon June 25 11:21-16:52 (3+05:30) reboot system boot3.10.0-693.el7.x Tue June 19 22:21-16:52 (8+18:31) //If you only need to see when the last Linux system started[Email protected]_0_5_centos ~]# last reboot | Head-1Reboot system Boot3.10.0-693.el7.x Thu June 28 16:52-11:27 (3+18:35) //w Command view, up indicates how long the system has been running, which in turn calculates the system restart time[Email Protected]_0_5_centos ~]# W11:30:35 up 3 days, 18:38, 1 user, load average:78.52, 73.84, 72.60USER TTY from [email protected] IDLE jcpu PCPU whatroot pts/0 222.211.233.166 11:18 3.00s 0.02s 0. 00s W//Uptime Command View[Email Protected]_0_5_centos ~]# Uptime11:33:18 up 3 days, 18:40, 1 user, load average:71.31, 72.56, 72.30//View by/proc/uptime[Email Protected]_0_5_centos ~]# cat/proc/Uptime266.50 209.15//The first number is the time that the system has been running for 266.5 seconds//Use the System tool date to calculate the system boot time[Email Protected]_0_5_centos ~]# date-d $ (awk-f. ' {print $} '/proc/uptime) second ago "+"%y-%m-%d%h:%m:%s "2018-06-28 16:52:24[[Email Protected]_0_5_centos~]# cat/proc/uptime| Awk-f. ' {run_days=$1/86400;run_hour= ($ 86400)/3600;run_minute= ($ 3600)/60;run_second=$1% 60;printf ("system has been running:%d days% D at%d seconds ", Run_days,run_hour,run_minute,run_second)} 'system has been running: 0 days 0:6 7 seconds//Top Command[Email Protected]_0_5_centos ~]# toptop-11:29:30 up 3 days, 18:37, 1 user, load average:71.57, 72.68, 72.20Tasks:164 total, running, sleeping, 0 stopped, 2Zombie%CPU (s): 13.0 us, 86.7 sy, 0.0 ni, 0.0 id, 0.0 wa, 0.0 hi, 0.3 si, 0.0Stkib Mem:1883616 Total, 75328 free, 804624 used, 1003664 buff/Cachekib Swap:0 Total, 0 free, 0 used. 642936Avail Mem//Top Command DescriptionThe first line description: top–: System Current time up: The server continuous running time, I have seen a server running for more than a year, Linux server is very stable. User: How many users are currently logged into the system load average: This side has 3 values representing the system in the first 1 minutes, 5 minutes, 15 minutes of the workload, the general single core load at 3-5 is more appropriate, often under 1, indicating that the CPU utilization is not high, above 5, the CPU will be in a higher load state, will be prone to downtime.
The second line is to show the number of tasks, where zombie to note that this is a zombie process, there is a zombie process to notice how the zombie process is generated. If the cause is not found, it may reappear even if it is killed. The third line indicates the operation of the CPU, and press 1 to show the operation of each core. The four lines indicate the memory usage. The five lines represent the swap space swap usage. The following shows the running state of the process. The meaning of each header representation is as follows: PID: Process number User: Process belongs to user PR/ni:priority/Nice value Process execution precedence virt:virtual Image (KB) Total virtual memory usage res:resident size (KB) resident memory shr:shared Mem size (KB) shared memory s:process S Tatus process Status%CPU:CPU Usage Rate%MEM: Memory Utilization Time+: The total time to use the CPU when the process starts running command: the commands that the process runs in the top state press F to view the table header field description.
More commands
1, uname-a//View Linux System Information commands for kernel/OS/cpu information2, Head-n 1/etc/Issue//View operating system version, is the number 1 not the letter L3, hostname//to view the Linux System Information command for a computer name4, Lsusb-TV//list Linux System Information commands for all USB devices5, Lspci-TV//List all PCI devices6, Lsmod//list the loaded kernel modules7, cat/proc/Loadavg//View system load disks and partitions8. Mount | Column-T//to view the status of a mounted partition9, Swapon-s//View all swap partitions10, Hdparm-i/dev/HDA//View disk parameters (for IDE devices only)11, DMESG |grep IDE//To view the IDE device detection network at startup12, Iptables-L//View firewall Settings13, Route–n//View the routing table14, netstat-LNTP//View all listening ports15, Netstat-ANTP//View all connections that have been established16, netstat-s//View the network statistics process17, PS-EF//View All Processes18, Chkconfig–list//List all system services19, Chkconfig–list |grep on//List all started system services programs20, cat/proc/Partitions//View System Information commands for Linux hard disk and partition information21, cat/proc/Meminfo//Linux system commands for viewing Linux system memory information22, cat/proc/Ioports//viewing device IO ports23, cat/proc/Interrupts//View Interrupts24, cat/proc/PCI//to view information about a PCI device
Play Linux Server common commands