0
点赞
收藏
分享

微信扫一扫

Linux 常用指令


linux查看文件大小

du -h --max-depth=1 echuandan ## 查看文件大小

linux 批量重命名

rename 's/\\.jpg/.gif/' *.jpg

本地nginx 配置文件

vi /usr/local/etc/nginx/nginx.conf

停止  nginx

sudo nginx -s stop

启动 nginx

sudo nginx

创建时间的shell指令

date "+%Y-%m-%d"

查看端口被占用情况

lsof -i tcp:port
ps aux | grep nginx
* 查看端口    lsof -i:8080

* 杀死进程 kill 345

* 关闭终端窗口 pkill -9 -t pts/0

* kill -9 强制终止

* ~代表你的/home/用户命目录 cd ~/Games 等于 cd /Users/terry/Games

* tldr tee 查看tee的使用方式

* grep -n 'module’ Gulpfile.js 搜索文件中的”module"

* ls | tee -a who.txt 将屏幕输出内容写入到who.txt
CentOS 6.x 和 CentOS 7.x 中 Nginx 的操作命令(启动/重启/退出/...)

--------- CentOS 6.x 中 Nginx 的操作命令 ---------

# nginx // 不指定配置文件启动 Nginx,默认读取 /etc/nginx/nginx.conf 配置文件。
# nginx -c <配置文件> // 指定配置文件启动 Nginx 。
# nginx -t // 测试配置文件是否有语法错误,通过这种方式,也就知道了默认配置文件是哪个文件。
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

# nginx -s reopen // 重启 Nginx
# nginx -s reload // 重新加载 Nginx 配置文件,然后以优雅的方式重启 Nginx 。
# nginx -s stop // 强制停止 Nginx 服务
# nginx -s quit // 优雅地停止 Nginx 服务(即处理完所有请求后再停止服务)

--------- CentOS 7.x 中 Nginx 的操作命令 ---------

# systemctl start nginx.service // 启动 Nginx 服务
# systemctl stop nginx.service // 停止 Nginx 服务
# systemctl restart nginx.service // 重启 Nginx 服务
# systemctl reload nginx.service // 重新加载 Nginx 配置文件,然后以优雅的方式重启 Nginx 。
# systemctl status nginx.service // 查看状态
# systemctl enable nginx.service // 设置开机自启动
# systemctl disable nginx.service // 停止开机自启动


举报

相关推荐

0 条评论