纪录一些linux服务器下查看系统配置的常用命令,系统主要采用CentOS,方便下次查找。

修改用户分组以及文件权限:

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

修改服务器防火墙

[root@iZbp1g3u73g9nybvafuwc6Z /]# vim /etc/sysconfig/iptables
添加一行:
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
/etc/rc.d/init.d/iptables restart #重启服务
/etc/rc.d/init.d/iptables status #再检查下

查看系统硬盘各个分区大小以及使用情况:

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

查看内存信息:

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

查看内存使用量(-M表示用M作为单位):

[root@iZbp1g3u73g9nybvafuwc6Z /]# free -m

查看CPU具体信息:

[root@iZbp1g3u73g9nybvafuwc6Z /]# cat /proc/cpuinfo

查看内核/操作系统/CPU概况:

[root@iZbp1g3u73g9nybvafuwc6Z /]# uname -a

查看操作系统信息:

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

查看所有的监听端口:

[root@iZbp1g3u73g9nybvafuwc6Z /]# netstat -lnt

查看已安装的软件包:

[root@iZbp1g3u73g9nybvafuwc6Z /]# 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

查看环境变量:

[root@iZbp1g3u73g9nybvafuwc6Z /]# 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

]# vim /etc/sysconfig/iptables
添加一行:
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
/etc/rc.d/init.d/iptables restart #重启服务
/etc/rc.d/init.d/iptables status #再检查下
查看系统硬盘各个分区大小以及使用情况:

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

查看内存信息:

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

查看内存使用量(-M表示用M作为单位):

[root@iZbp1g3u73g9nybvafuwc6Z /]# free -m

查看CPU具体信息:

[root@iZbp1g3u73g9nybvafuwc6Z /]# cat /proc/cpuinfo

查看内核/操作系统/CPU概况:

[root@iZbp1g3u73g9nybvafuwc6Z /]# uname -a

查看操作系统信息:

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

查看所有的监听端口:

[root@iZbp1g3u73g9nybvafuwc6Z /]# netstat -lnt

查看已安装的软件包:

[root@iZbp1g3u73g9nybvafuwc6Z /]# 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

查看环境变量:

[root@iZbp1g3u73g9nybvafuwc6Z /]# env
HOSTNAME=iZ23kwb30cqZ
TERM=xterm
SHELL=/bin/bash
HISTSIZE=1000
SSH_CLIENT=61.175.197.170 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

Logo

更多推荐