linux常用命令
文件
上传
scp path/filename userName@severName:path
下载
scp userName@severName:path path/filename
rzsz
工具也可以用于上传
配置 ssh 免密登录
- 生成秘钥对
ssh-keygen -t rsa -C "你的名字" -f "生成的文件名"
- 拷贝公钥到服务器
ssh-copy-id -i ~/.ssh/id_rsa.pub root@192.168.135.102
注意:检查公钥文件的访问权限需要为 600
-
配置本地私钥 1)将生成的私钥放到
~/.ssh/
路径下 2)(可选)配置文件权限为 600 -
(可选)配置
~/.ssh/config
, 内容如下
# 多主机配置
Host gateway-produce
HostName IP或绑定的域名
Port 22
Host node-produce
HostName IP或绑定的域名
Port 22
Host java-produce
HostName IP或绑定的域名
Port 22
Host *-produce
User root
IdentityFile ~/.ssh/produce_key_rsa
Protocol 2
Compression yes
ServerAliveInterval 60
ServerAliveCountMax 20
LogLevel INFO
#单主机配置
Host evil-cloud
User root
HostName IP或绑定的域名
IdentityFile ~/.ssh/evilboy_rsa
Protocol 2
Compression yes
ServerAliveInterval 60
ServerAliveCountMax 20
LogLevel INFO
#单主机配置
Host git.yideng.site
User git
IdentityFile ~/.ssh/evilboy_rsa
Protocol 2
Compression yes
ServerAliveInterval 60
ServerAliveCountMax 20
LogLevel INFO
查看 nginx 错误日志
tail -f /var/log/nginx/error.log
查看 nginx 端口配置错误
find /etc/nginx/conf.d/ -name "*.conf" | xargs grep "80"
查看端口占用
lsof -i:8083
查看系统进程
ps -aux|grep pm2
查看当前文件大小
du -hd 1