In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
Today, I will talk to you about how to view system information in CentOS. Many people may not know much about it. In order to make you understand better, the editor has summarized the following content for you. I hope you can get something according to this article.
View system information
One: check cpu
More / proc/cpuinfo | grep "model name" grep "model name" / proc/cpuinfo
If you feel the need to see more comfortable
The code is as follows:
Grep "model name" / proc/cpuinfo | cut-f2-d:
Well, linux's commands should be so familiar.
Two: check inside
The code is as follows:
[root@CentOS ~] # grep MemTotal / proc/meminfo [root@CentOS ~] # grep MemTotal / proc/meminfo | cut-f2-d: [root@CentOS ~] # free-m | grep "Mem" | awk'{print $2}'[root@CentOS ~] # free-m
Three: check whether the cpu is 32-bit or 64-bit
View CPU digits (32 or 64)
The code is as follows:
[root@CentOS ~] # getconf LONG_BIT [root@CentOS ~] # echo $HOSTTYPE [root@CentOS ~] # uname-a
Four: check the current version of linux
The code is as follows:
[root@CentOS ~] # more / etc/redhat-release [root@CentOS ~] # cat / etc/redhat-release
Five: check the kernel version
The code is as follows:
[root@CentOS ~] # uname-r
[root@CentOS] # uname-a
Six: view the current time
The code is as follows:
[root@CentOS ~] # date
Seven: view hard drives and partitions
The code is as follows:
[root@CentOS] # df-h
[root@CentOS ~] # fdisk-l
You can also view partitions
The code is as follows:
[root@CentOS home] # du-sh
You can see all the space occupied.
The code is as follows:
[root@CentOS home] # du / var/www-sh
You can see the size of this directory
Eight: check the installed software packages
Check the software packages installed when the system is installed
The code is as follows:
Cat-n / root/install.log
More / root/install.log | wc-l
Check which packages have been installed now
The code is as follows:
[root@CentOS home] # rpm-qa
[root@CentOS home] # rpm-qa | wc-l
[root@CentOS home] # yum list installed | wc-l
Strangely, however, the number of installation packages I have queried through rpm and yum is not the same. I can't find the reason.
Nine: view the keyboard layout
The code is as follows:
[root@CentOS home] # cat / etc/sysconfig/keyboard
[root@CentOS home] # cat / etc/sysconfig/keyboard | grep KEYTABLE | cut-f2-d =
Ten: check the selinux situation
The code is as follows:
[root@CentOS home] # sestatus
[root@CentOS home] # sestatus | cut-f2-d:
[root@CentOS home] # cat / etc/sysconfig/selinux
Eleven: check the ip,mac address
You can see mac, gateway and other information in the ifcfg-eth0 file.
The code is as follows:
[root@CentOS home] # ifconfig
[root@CentOS home] # cat / etc/sysconfig/network-scripts/ifcfg-Auto_eth0
[root@CentOS home] # cat / etc/sysconfig/network-scripts/ifcfg-Auto_eth0 | grep IPADDR | cut-f2-d =
[root@CentOS home] # ifconfig eth0 | grep "inet addr:" | awk'{print $2}'| cut-c 6-
[root@CentOS home] # ifconfig | grep 'inet addr:' | grep-v' 127.0.0.1'| cut-d:-f2 | awk'{print $1}'
View Gateway
The code is as follows:
[root@CentOS home] # cat / etc/sysconfig/network
View dns
The code is as follows:
[root@CentOS home] # cat / etc/resolv.conf
Twelve: view the default language
The code is as follows:
[root@CentOS home] # echo $LANG $LANGUAGE
[root@CentOS home] # cat / etc/sysconfig/i18n
Thirteen: check the time zone and whether to use UTC time
The code is as follows:
[root@CentOS /] # cat / etc/sysconfig/clock
Fourteen: view hostname
The code is as follows:
[root@CentOS /] # hostname
[root@CentOS /] # cat / etc/sysconfig/network
Configure the firewall
It is very necessary to configure iptables firewall under CentOS. Come on let's learn how to configure!
I mentioned firewall configuration in my blog.
Set the firewall in Linux, and take CentOS as an example, open the configuration file of iptables:
The code is as follows:
Vi / etc/sysconfig/iptables
Use the / etc/init.d/iptables status command to query whether port 80 is open, and if not, you can handle it in two ways:
1. Modify the vi / etc/sysconfig/iptables command to make the firewall open port 80
The code is as follows:
-A RH-Firewall-1-INPUT-m state-- state NEW-m tcp-p tcp-- dport 80-j ACCEPT
two。 Turn off / turn on / restart the firewall
The code is as follows:
/ etc/init.d/iptables stop
# enable start
# restart restart
3. Permanently turn off the firewall
The code is as follows:
Chkconfig-level 35 iptables off
/ etc/init.d/iptables stop
Iptables-P INPUT DROP
4. Open port 21 in active mode
The code is as follows:
Iptables-An INPUT-p tcp-- dport 21-j ACCEPT
5. Open the port between passive mode 49152 and 65534
The code is as follows:
Iptables-An INPUT-p tcp-- dport 49152 tcp 65534-j ACCEPT
Iptables-An INPUT-I lo-j ACCEPT
Iptables-An INPUT-m state-- state ESTABLISHED-j ACCEPT
Note:
Be sure to give yourself a way back, leaving a management port for VNC and a management port for SSh.
It is important to note that you must modify this file according to the situation of your server.
Restart iptables after all modifications:
The code is as follows:
Service iptables restart
You can verify that the rules are already in force:
The code is as follows:
Iptables-L
After reading the above, do you have any further understanding of how to view system information in CentOS? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.