Linux常用命令集合
关机重启:
shutdown命令
1.shutdown 命令的基本信息如下。
2.命令名称:shutdown。
3.英文原意:bring the system down。
4.所在路径:/sbin/shutdown。
5.执行权限:超级用户。
6.功能描述:关机和重启
[root@localhost ~]# shutdown [选项] 时间 [警告信息]
选项:
-c:取消已经执行的 shutdown 命令;
-h:关机;
-r:重启;
init命令
init 是修改 Linux 运行级别的命令,也可以用于关机和重启。
[root@localhost~]# init 0
#关机,也就是调用系统的 0 级别
[root@localhost ~]# init 6
#重启,也就是调用系统的 6 级别
文件操作:
切换目录:cd [dirName]
查看目录下文件:ls
查看目录下文件权限:ls -l
新建文件:mkdir -p 文件夹名 p 确保目录名称存在,不存在的就建一个
新建文本文档:touch 文件名.txt
修改文件权限:chmod 777 文件名
标题777为最大权限根据需求修改
防火墙常用命令:
1 关闭防火墙-----service iptables stop
2 启动防火墙-----service iptables start
3 重启防火墙-----service iptables restart
4 查看防火墙状态–service iptables status
5 永久关闭防火墙–chkconfig iptables off
6 永久关闭后启用–chkconfig iptables on
开启某端口:
打开/etc/sysconfig/iptables
vi /etc/sysconfig/iptables
写入以下内容
-A INPUT -p tcp -m state --state NEW -m tcp --dport 端口号 -j ACCEPT
重启防火墙。