linux常用命令

tail -f application.log(实时查看日志文件)

gzip -d xxx.gz(解压gzip文件)

tar –xvf file.tar //解压 tar包

tar -xzvf file.tar.gz //解压tar.gz

wget -c http://www.linuxsense.org/xxxx/xxx.tar.gz(下载 )

https://www.cnblogs.com/yuanbo123/p/5819564.html(java安装)

sudo shutdown -r now(重启)

https://blog.csdn.net/c233728461/article/details/52679558(端口)

find / -name nginx(查找文件)

/usr/sbin/nginx -s reload(nginx重启)

用户

https://jingyan.baidu.com/article/a17d5285eb93ea8099c8f24d.html(切换用户)

https://www.cnblogs.com/biaopei/p/7730542.html(root权限分配)

https://www.cnblogs.com/mylinux/p/5576316.html(用户操作)

ES

安装:https://www.cnblogs.com/lizichao1991/p/7809156.html

https://blog.csdn.net/qq_15175765/article/details/78862797(log4j*错误)

重启:

ps -ef | grep elastic

kill -9 3250

elasticsearch -d

安装node

(cd 'usr/local',去nodejs官网查看linux二进制包地址)

wget https://nodejs.org/dist/v10.14.1/node-v10.14.1-linux-x64.tar.xz

tar -xvJf node-v10.14.1-linux-x64.tar.xz

tar -xvf node-v10.14.1-linux-x64.tar

ln -s /usr/local/node-v10.14.1-linux-x64/bin/node /usr/local/bin/node

ln -s /usr/local/node-v10.14.1-linux-x64/bin/npm /usr/local/bin/npm

npm install -g n

ln -s /usr/local/node-v10.14.1-linux-x64/bin/n /usr/local/bin/n

https://www.jb51.net/article/98153.htm(如果不生效,Linux切换node版本)

vi ~/.bashrc(设置环境变量,添加下面这行:)

export PATH=/usr/local/node/bin:$PATH(linux添加环境变量)

puppereer在centos下的问题

提升缺少 libXcomposite 等依赖:

yum -y install libX11 libXcomposite libXcursor libXdamage libXext libXi libXtst cups-libs libXScrnSaver libXrandr alsa-lib pango atk at-spi2-atk gtk3

MAC

## 常用终端命令
Mac查看端口占用 lsof -i tcp:port
Mac杀掉进程 kill Pid

定时任务(适用于root用户)

1. 新建shell脚本

如:/root/restartPM2.sh

#!/bin/bash

ENABLE_NODE_LOG=YES pm2 restart all

设权限:chmod 755 restartPM2.sh

2. 添加定时任务(每小时的30分钟重启pm2)

vi /etc/crontab

SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root

# For details see man 4 crontabs

# Example of job definition:
# .---------------- minute (0 - 59)
# |  .------------- hour (0 - 23)
# |  |  .---------- day of month (1 - 31)
# |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...
# |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# |  |  |  |  |
# *  *  *  *  * user-name  command to be executed
30 * * * * root /root/shell/restartPM2.sh

3. 重启crond

service crond restart

* PM2自带定时重启功能

"cron_restart": "30 * * * *",
"instances" : 1,
"exec_mode" : "cluster"

 

Nginx

yum install -y nginx

systemctl start nginx.service

启动:nginx

停止:nginx -s stop

重启:nginx -s reload

配置文件地址:/etc/nginx/nginx.conf( 检测:nginx -t )

默认网站地址:/usr/share/nginx/html

 

Mongodb

https://my.oschina.net/soben/blog/2966991

posted @ 2018-09-27 15:36  暖风叔叔  阅读(290)  评论(0编辑  收藏  举报