linux經常使用命令

tail -f application.log(實時查看日誌文件)html

gzip -d xxx.gz(解壓gzip文件)java

tar –xvf file.tar //解壓 tar包node

tar -xzvf file.tar.gz //解壓tar.gzlinux

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

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

sudo shutdown -r now(重啓)npm

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

find / -name nginx(查找文件)bash

/usr/sbin/nginx -s reload(nginx重啓)app

用戶

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

相關文章
相關標籤/搜索