一些常用的命令(持续更新)

docker 相关

  • 保存镜像
docker save -o xxxx.tar  xxxx:1.0
  • 加载镜像
docker load < xxxx.tar 
  • 容器扩容--storage-opt size=120G
docker run -m 8G --name xxxx --storage-opt size=120G -v /data/xxx:/data/xxx -v /data/xxx/xxx:/data/xxx/xxx-v /etc/localtime:/etc/localtime:ro $(cat /etc/hosts|awk -F ' ' '{if(NR>2){print "--add-host "$2":"$1}}') -p 8081:8081 -itd    xxxx:1.0  

linux常用命令

  • 跨服务器复制文件
scp /opt/xx/xxx.jar [email protected]:/opt/xx/xx

仅限文件,不能复制文件夹

  • 查询大量tcp连接CLOSE_WAIT
netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}'

ESTABLISHED 表示正在通信,TIME_WAIT 表示主动关闭,CLOSE_WAIT 表示被动关

  • 查看端口占用情况
lsof -i:8383

需要安装lsof

  • 查看文件(夹)大小
du -h xxx.txt 
du -h xxx
  • 查看磁盘占用情况
df -h
  • zip压缩文件(将 /home/html/ 这个目录下所有文件和文件夹打包为当前目录下的 html.zip)
zip -q -r html.zip /home/html

git相关

  • tag创建并推送
git tag -a V1.0.0 -m "安全改造2.0+ S18.5期需求上线"  # V1.0.0为版本号 ,-m 后为tag注释
git push --tags
  • git stash暂存

    git stash 使用的场景一般有两种:

    • 多人修改同一分支,我在本地修改好后,发现远程分支已经被改动了,此时是无法pull的。
    git stash #先将本地代码暂存至缓存区域
    git pull --rebase #再更新代码至本地
    git pop   #再将暂存区域代码重新加载到本地
    
    • 不小心改动了其他分支代码。比如本来是在feature/feature01分支上开发,一不小心切换到了master 分支,并且在master分支上修改了代码,这个时候想把代码切换到feature/feature01分支
    git stash #先将本地代码暂存至缓存区域
    git checkout feature/feature01 #再将分支切换到feature/feature01分支
    git pull --rebase # 非必须步骤,更新远程代码到本地
    git pop  #再将暂存区域代码重新加载到本地
    
    • 删除远端分支
git push origin --delete Chapater6 

ffmpeg

  • 根据码率压缩视频
 .\ffmpeg.exe -i .\1(8M).mp4 -b:v 50k 1.mp4

猜你喜欢

转载自blog.csdn.net/wagnteng/article/details/124728664