清水

最小的善行胜过最大善念

Linux常用命令汇总

Linux操作系统用于服务器居多,所以一般都少安装图形界面,管理服务器都通过命令行操作,要在一篇文章里讲述所有命令也不现实,这篇文章只记录本人常用到的命令,备忘为主。

关闭防火墙:systemctl stop firewalld.service

解压 .tar.gz 文件:tar -zxvf web.tar.gz,tar 不支付解压文件到指定的目录。

解压 .war .zip 文件到指定目录:unzip web.war -d webapps/

关闭 SELINUX:vi /etc/selinux/config,注释掉 SELINUX=enforcingSELINUXTYPE=targeted,添加 SELINUX=disabled:wq! 保存退出,setenforce 0 使配置立即生效。

查看某服务状态:systemctl status uwsgi.service

更改文件或目录的所有者:chown pcvc:pcvc /the/full/path/or/file

systemctl 的常规用法:systemctl 动作 服务名.service,动作有:start启动, stop停止, restart重启, status状态, enable开机启动, disable开机不启动, is-enabled, is-active

列出所有运行中的服务:systemctl list-units --type=servicesystemctl list-unit-files