一、基础命令
- 上传文件
scp ./test.txt root@111.111.111.111:/root
把本地当前目录下的 test.txt 文件上传到 root 用户的根目录 root 文件夹下。
- 下载软件
yum install nano
- 查看服务状态
systemctl status nginx
- 停止服务
systemctl stop nginx
- 开启服务
systemctl start nginx
- 重启服务
systemctl restart nginx
- 创建文件 test.txt 并将 hello world! 写入
echo “hello world!” > test.txt
- 网卡位置
/etc/sysconfig/network-scripts 下面的 ifcfg-eth0 文件
- 查看网络地址
ip route
- 端口相关
- 查看打开了多少
netstat
ss
ss -an
- 查看其中某个端口
ss -an | grep 80
- 查看其中占用端口的进程
ss -anp | grep 80
- 干掉进程(一般来说,pid 数字较小的是主进程)
kill - [pid]
pkill [nginx]
- 下载
- 服务器的时间戳
wget www.baidu.com
- 本地的时间戳
curl www.baidu.com -o test.html
- 手册
man [命令]
- 任务管理器
top
- 跑了哪些进程
ps aux
ps aux | grep ngnix
- 哪些用户登陆了服务器
w
- 登陆服务器历史
last
- 只显示 10 条
last -n 10
- 登录失败的记录
lastb
二、control 相关
- 不小心 control + s 了怎么办?
control + s 是锁定终端的意思,这时候需要用 control + q 解锁
- 清屏
control +l
- 结束输入或退出 shell
control + d
- 光标快速移动到开头/结尾
control + a / control + e
三、安装 Node.js
添加官⽅的yum源
curl -sL rpm.nodesource.com/setup_11.x | bash -
yum命令安装
yum install -y nodejs
PS : mac 是 BSD 内核