CentOS常用操作笔记

init 3 关闭图形界面

init 5 开启图形界面

开机默认不进入图形界面:

vi /etc/inittab

id:5:initdefault:

改为

id:3:initdefault:

查看8005端口占用情况

lsof -i:8005

查看Linux服务器的版本

lsb_release -a 

查看当前iptables(防火墙)规则

  可使用"iptables –L –n"查看当前iptables规则

查看防火墙状态:service iptables status  

停止防火墙:service iptables stop  

启动防火墙:service iptables start  

重启防火墙:service iptables restart  

永久关闭防火墙:chkconfig iptables off  

永久关闭后重启:chkconfig iptables on

添加指定端口到防火墙中

iptables -I INPUT -p 协议 --dport 端口号 -j ACCEPT

iptables -I INPUT -p udp --dport 161 -j ACCEPT 

iptables -I INPUT -p tcp --dport 8080 -j ACCEPT

查看当前路径:  pwd             /home/samlee

使用rpm -qa | grep httpd查看是否已经安装了httpd

使用ps -ef | grep httpd查看httpd的进程

使用service httpd status查看httpd的运行状态

使用service httpd stop可以停止httpd

使用service httpd start 可以启动httpd

find / -name apsx

查看进程端口: ps aux | grep yum

终止进程:kill -9 pid

猜你喜欢

转载自blog.csdn.net/bokerr/article/details/82253979