Common commands to view system configuration under linux server

Record some common commands to view the system configuration under the linux server. The system mainly uses CentOS, which is convenient for the next search.

Modify user group and file permissions:

chown -R user:user apache-tomcat-admin/
chown -R user apache-tomcat-admin/
chmod -R 777 apache-tomcat-admin/

Modify server firewall

[root@test ~]# vim /etc/sysconfig/iptables
Add a line:
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
/etc/rc.d/init.d /iptables restart #Restart the service
/etc/rc.d/init.d/iptables status #Check again

Check the size and usage of each partition of the system hard disk:

[root@iZ23kwb30cqZ java]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 40G 1.9G 36G 6% /
tmpfs 499M 0 499M 0% /dev/shm

View memory information:

[root@iZ23kwb30cqZ java]# cat /proc/meminfo |more
MemTotal: 1020276 kB
MemFree: 79264 kB
Buffers: 83336 kB
Cached: 706808 kB

View memory usage (-M means use M as unit):

[root@iZ23kwb30cqZ java]# free -m

View CPU specific information:

[root@iZ23kwb30cqZ java]# cat /proc/cpuinfo

View kernel/OS/CPU profiles:

[root@iZ23kwb30cqZ java]# uname -a

View operating system information:

[root@iZ23kwb30cqZ java]# cat /etc/issue
CentOS release 6.5 (Final)

View all listening ports:

[root@hs-192-168-58-175 ~]# netstat -lnt

View installed packages:

[root@iZ23kwb30cqZ java]# rpm -qa
python-libs-2.6.6-52.el6.x86_64
basesystem-10.0-4.el6.noarch
bind-libs-9.8.2-0.23.rc1.el6_5.1.x86_64
libproxy-python-0.3.0-4.el6_3.x86_64
ncurses-base-5.7-3.20090208.el6.x86_64
selinux-policy-3.7.19-231.el6_5.3.noarch
libreport-2.0.9-19.el6.centos.x86_64
glib2-2.26.1-7.el6_5.x86_64

View environment variables:

[root@iZ23kwb30cqZ java]# env
HOSTNAME=iZ23kwb30cqZ
TERM=xterm
SHELL=/bin/bash
HISTSIZE=1000
SSH_CLIENT=61.175.197.70 49788 22
OLDPWD=/usr/local/java/jdk1.8.0_51
SSH_TTY=/dev/pts/0
JRE_HOME=/usr/local/java/jdk1.8.0_51/jre
USER=root

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326640580&siteId=291194637