常用Shell脚本命令(备忘)
此处纪录一些个人常用的Shell命令,留作复用

Linux 必备软件
- Tmux 终端复用神器
- zsh 无比强大Shell运行环境
- oh my zsh 搭配zsh食用
- uGet Linux下载工具
- Docker-Compose 镜像编排工具
Linux 字体
- Moncao 推荐字体
Docker
- 启动容器
docker start <镜像ID>
- 停止容器
docker stop <容器ID>
- 删除容器
docker rm <容器id>
- 删除Docker中镜像名称为none的镜像
docker rmi ` docker images | awk '$1=="<none>" {print $3}'`
Docker部署项目
Docker镜像编排
shell_dir="/home/yan/code/shell/dmc"
echo -e "\033[47;34m -----------正在准备编译----------- \033[0m"
# 切换到DMC_USER目录
echo -e "\033[47;34m -----------编译DMC_USER----------- \033[0m"
#配置相关的路径地址
cd ${shell_dir}/user
./install_dmc_user.sh
#开始部署DMC_API
echo -e "\033[47;34m -----------编译DMC_APIM----------- \033[0m"
cd ${shell_dir}/apim
./install_dmc_apim.sh
# 开始部署
cd ${shell_dir}
echo -e "\033[47;34m -----------正在停止docker-compose服务-----------\033[0m"
docker-compose stop
echo -e "\033[47;34m -----------停止服务完成,开始后台部署----------- \033[0m"
docker-compose up -d
echo -e "\033[47;34m -----------后台部署完成,请检查程序运行状况,信息如下: \033[0m"
docker-compose ps
构建镜像
#配置相关的路径地址
#配置项目名称
project_name="DMC_APIM"
# 配置源码地址
project_dir="/home/yan/code/work/zhuxun/dmc_apim"
#配置shell地址
shell_dir="/home/yan/code/shell/dmc/apim"
echo -e "\033[47;34m -----> 正在准备编译项目${project_name} \033[0m"
echo "....."
#切换到项目目录
cd ${project_dir}
echo -e "\033[47;34m -----> 已经成功切换到${project_name}的工作目录 \033[0m"
#使用gradle编译,跳过单元测试
./gradlew build -x test
if [ $? -eq 0 ]; then
echo -e "\033[47;34m -----> 正在拷贝JAR文件 \033[0m"
# 编译成功,则将JAR文件拷贝当前Shell目录
cp build/libs/dmc_apim-0.0.1-SNAPSHOT.jar ${shell_dir}/dmc_apim.jar
cd ${shell_dir}
echo "编译成功,正在编译为Docker镜像,请等待...."
echo -e "\033[47;34m -----> 编译成功,正在构建为Docker镜像,请等待....\033[0m"
# 使用docker build命令构建镜像文件
docker build -t dmc_apim:latest ${shell_dir}
if [ $? -eq 0 ]; then
echo -e "\033[47;34m -----> 构建镜像成功,请使用docker images命令查看效果.....\033[0m"
fi
fi
Snap
安装
安装离线包
sudo snap install 离线包文件.snap --devmode --dangerous
常用Shell脚本命令(备忘)的更多相关文章
- 常用shell脚本命令
常用shell脚本命令 1.显示包含文字aaa的下一行的内容: sed -n '/aaa/{n;p;}' filename 2.删除当前行与下一行的内容: sed -i '/aaa/{N;d;}' f ...
- metasploit 常用命令备忘
metasploit 常用命令备忘 MSFconsole Commands-------------------------------------24show exploits 查看所有exp ...
- Linux常用Shell脚本珍藏【转载】
我们在运维中,尤其是linux运维,都知道脚本的重要性,脚本会让我们的 运维事半功倍,所以学会写脚本是我们每个linux运维必须学会的一门功课,这里收藏linux运维常用的脚本.如何学好脚本,最关键的 ...
- 8个DBA最常用的监控Oracle数据库的常用shell脚本
本文介绍了8个常用的监控数据shell脚本.首先回顾了一些DBA常用的Unix命令,以及解释了如何通过Unix Cron来定时执行DBA脚本.网上也有好多类似的文章,但基本上都不能正常运行,花点时间重 ...
- git 命令备忘
git 常用命令备忘 仅作为日常使用备忘,并非常用命名整理 删除源端分支 git push orgin --delete branch_a a分支某次提交应用到b分支 切换到branch_b 分支: ...
- shell脚本命令(sotr/unip/tr/cut/eval)与正则表达式
shell脚本命令(sotr/unip/tr/cut/eval)与正则表达式 1.sort命令 概述: Linux sort命令用于将文本文件内容加以排序. sort命令可针对文本文件的内容,以行为单 ...
- linux 基础 shell脚本命令
#########shell脚本命令#### 1.diff diff file file1 ####比较两个文件的不同 -c ####显示周围的行 -u ####按照一格式统一输出生成补丁 -r ## ...
- win7 cmd终端连接android手机运行adb shell脚本命令
win7 cmd终端连接android手机运行adb shell脚本命令 (2013-03-22 20:13:57) 转载▼ 标签: android it shell 连接 linux 分类: 嵌入式 ...
- linux 常用shell脚本语句
最近老大让写一个shell脚本,每天从一个固定IP中取到相应文件,所以想写一个简单的shell脚本命令,供大家学习交流.先做一个简单的例子,先看效果吧, 代码如下: #!/bin/sh #定义一个变量 ...
随机推荐
- 爱奇艺技术分享:爱奇艺Android客户端启动速度优化实践总结
本文由爱奇艺技术团队原创分享,原题<爱奇艺Android客户端启动优化与分析>. 1.引言 互联网领域里有个八秒定律,如果网页打开时间超过8秒,便会有超过70%的用户放弃等待,对Andro ...
- [Swift]LeetCode502. IPO(首次公开募股) | Initial Public Offerings
Suppose LeetCode will start its IPO soon. In order to sell a good price of its shares to Venture Cap ...
- [Swift]LeetCode620. 有趣的电影 | Not Boring Movies
SQL架构 Create table If Not Exists cinema (id ), description varchar(), rating , )) Truncate table cin ...
- [Swift]LeetCode893. 特殊等价字符串组 | Groups of Special-Equivalent Strings
You are given an array A of strings. Two strings S and T are special-equivalent if after any number ...
- [Swift]LeetCode905. 按奇偶排序数组 | Sort Array By Parity
Given an array A of non-negative integers, return an array consisting of all the even elements of A, ...
- [Swift]LeetCode949. 给定数字能组成的最大时间 | Largest Time for Given Digits
Given an array of 4 digits, return the largest 24 hour time that can be made. The smallest 24 hour t ...
- 好用的函数,assert,random.sample,seaborn tsplot, tensorflow.python.platform flags 等,持续更新
python 中好用的函数,random.sample等,持续更新 random.sample random.sample的函数原型为:random.sample(sequence, k),从指定序列 ...
- 一串数字中,只有一个数字出现一次,其他数字都出现两次,查找出这个数字(python)(原创)
背景: 电话面试&手撕代码 2019.03.22 Mufasa 问题: 一串数字中,只有一个数字出现一次,其他数字都出现两次,查找出这个数字 条件: 这串数字是有序数 解决方法: 核心代码只有 ...
- Mac版AppStore无法下载、升级错误处理
在mac版本AppStore下载软件的时候,有时会出现"This item is temporarily unavailable, Try again later"错误提示,当然等 ...
- SpringBoot入门教程(十九)@ControllerAdvice+@ExceptionHandler全局捕获Controller异常
在spring 3.2中,新增了@ControllerAdvice 注解,可以用于定义@ExceptionHandler.@InitBinder.@ModelAttribute,并应用到所有@Requ ...