Linux 常用命令

查看用户和用户组

cut -d : -f 1 /etc/passwd|grep apache;

cut -d : -f 1
查看用户操作:w命令(需要root权限)
查看某一用户:w 用户名
查看登录用户:who
查看用户登录历史记录:last

#/sbin/iptables -I INPUT -p tcp –dport 80 -j ACCEPT
#/sbin/iptables -I INPUT -p tcp –dport 22 -j ACCEPT
#/etc/rc.d/init.d/iptables save

这样重启计算机后,防火墙默认已经开放了80和22端口

这里应该也可以不重启计算机:
#/etc/init.d/iptables restart

防火墙的关闭,关闭其服务即可:

查看防火墙信息:
#/etc/init.d/iptables status

关闭防火墙服务:
#/etc/init.d/iptables stop

永久关闭?不知道怎么个永久法:
#chkconfig –level 35 iptables off

关闭 SELinux 

setenforce 0

原文地址:https://www.cnblogs.com/jackluo/p/2866175.html