杂货箱
管道符
<command1> | <commmand2> | <commmand3>
第一个命令的标准输出作为第二个命令的标准输入,第二个命令的标准输出作为第三个命令的标准输入
常用工具
sftp
传输文件
screen
screen -ls 查看当前会话
screen -r name 恢复指定name的会话
screen -S name 创建一个会话并命名为name
screen -R [pid/Name] -X quit 删除一个会话
screen -d name 处理There is no screen to be resumed matching
bashctrl
+ a
+d
退出当前会话,也可以用于断开 ssh 连接
yum
yum install 包名 -y 安装包
yum update -y 更新所有包
yum update 包名 -y 更新指定包
yum remove 包名 卸载包
bashpm2
pm2 ls 查看列表
pm2 start app.js --name [name] --watch 启动应用并监视
pm2 stop [name] 停止
pm2 restart [name] 重启
pm2 delete [name] 删除
bashffmpeg
# 压缩成宽度为 640 像素,并使用 80% 的质量进行压缩
ffmpeg -i input.jpg -vf scale=640:-1 -quality 80 output.jpg
shelldocker
docker stats <container_name>
docker run -dit --name <name> -p 3941:3941 <image>
# 列出所有正在运行的容器
docker ps
# 列出所有容器
docker ps -a
# 查看镜像
docker image ls
# 以交互式的方式进入容器
docker exec -it <name> bash
# 构建镜像
# 例如: docker build -t kimika-server-ts:latest .
docker build -t <name:tag> .
shellrsync
rsync -r <source> <destination>
shell其他
# 删除一个`file1`文件
rm -f <file>
# 删除`dir1`目录
rmdir <dir>
# 删除`dir1`目录,同时删除其内容
rm -r <dir>
# 重命名或移动一个目录
mv <orign> <target>
# 释放一个包
tar -xvf archive.tar
# 查看PATH,并格式化输出
echo $PATH | tr : '\n'
# 更改文件大小
truncate -s 20MB <file>
# 连接 wifi
nmcli dev wifi connect 'Redmi Note 10 Pro' password "12345678"
# 时间同步,需要 root 权限
ntpdate cn.pool.ntp.org
shell