删除命令: rm
rm 删除文件
rm -rf 删除文件夹 强制递归删除 (就是删除文件夹(有文件也删,没文件也删))
如果删除有文件的文件夹 不加 -rf 会出现 rm: cannot remove ‘bin’: Is a directory
关闭防火墙
centos7之前版本
1. 永久性生效
开启:chkconfig iptables on
关闭:chkconfig iptables off
2. 即时生效,重启后失效
开启:service iptables start
关闭:service iptables stop
centos7默认使用的是firewall作为防火墙
查看防火墙状态
firewall-cmd --state
停止firewall
systemctl stop firewalld.service
禁止firewall开机启动
systemctl disable firewalld.service
centos7 开放/禁用端口
firewall-cmd --zone=public --add-port=8088/tcp --permanent # 开放8088端口
firewall-cmd --zone=public --remove-port=8088/tcp --permanent #关闭8088端口
firewall-cmd --reload # 配置立即生效
firewall-cmd --zone=public --list-ports #查看防火墙所有开放的端口
执行命令
启动tomcat
切换到tomcat主目录下的bin目录(/usr/local/src/apache-tomcat-7.0.96/bin)
1 直接启动 ./startup.sh (我一般都直接启动)
2 方式二:作为服务启动 nohup ./startup.sh &
3 方式三:控制台动态输出方式启动 ./catalina.sh run 动态地显示tomcat后台的控制台输出信息,Ctrl+C后退出并关闭服务
查看进程
ps -ef | grep 进程名称
pgrep 进程名称
ps -ef | grep firefox | grep -v grep | cut -c 9-15 | xargs kill -s 9
解释说明:
grep firefox的输出结果是,所有含有关键字“firefox”的进程
grep -v grep是在列出的进程中去除含有关键字“grep”的进程
cut -c 9-15是截取输入行的第9个字符到第15个字符,而这正好是进程号PID
xargs kill -s 9中的xargs命令是用来把前面命令的输出结果作为kill -s 9命令的参数,并执行该命令
kill -s 9会强行杀掉指定进程
杀死进程
kill -s 9 进程号
虚拟机重启
shutdown -h now :立即关机
shutdown -h 10:53:到10:53关机
shutdown -h +10 :10分钟后自动关机
shutdown -r :重启(默认30秒)
shutdown -r now :立即重启
shutdown -r +30 :’The System Will Reboot 30 in Mins’:30分钟后重启并发送通知给其他在线用户
shutdown -s -t 100 :延迟100秒关机
shutdown -a :取消上面的关机、重启
reboor :重启,相当于shutdown -r now