Skip to content

Linux ​

  • 2018

Shell脚本👻 ​

Ubuntu🐟 ​

  • 允许root远程登入
  • vim /etc/ssh/sshd_config
  • Authentication 下面添加 PermitRootLogin yes
shell
# Authentication:

#LoginGraceTime 2m
#PermitRootLogin prohibit-password
PermitRootLogin yes
  • Vm-Box NAT网络
  • 可以进行手动配置跟宿主机一样的ip也能互相ping通

镜像源😎 ​

Centos7🐔 ​

自动化脚本🌈 ​

Mysql8安装🌈 ​

Ffmpeg💒 ​

Deepin🎁 ​

  • 目前已安装到Ubuntu中使用

内存搭配🐸 ​

常用命令👏 ​

Date(时间)🌈 ​

shell
#设置时区
timedatectl set-timezone Asia/Shanghai
#查看当前时间
date +%Y/%m/%d-%H:%M

Crontab(定时)🍊 ​

shell
crontab -e 编辑任务
#实例1:每1分钟执行一次myCommand
* * * * * myCommand
#实例6:每晚的00:00重启smb
0 00 * * * /etc/init.d/smb restart

Tar(压缩)🗾 ​

shell
#解压 xx.tar.gz
tar -zxvf ${file.tar.gz}

Zip(压缩)🍒 ​

shell
# 压缩zip打包和子目录
zip -r -q -o ${file.zip} ${filePaht}

Lrzsz(上传文件)🎁 ​

  • xFtp已完全替代
shell
sz 文件名

Vim🐸 ​

字体颜色变黄🌈 ​

  • :nohl 即可回归正常

Awk🐯 ​

获取docker容器id💒 ​

shell
docker images | awk 'NR == 1 {next}{print $1}'
docker images | awk 'NR == 1 {next}{print $3}'

使用awk命令导出所有镜像😆 ​

shell
#!/bin/bash
echo Hello World
list1=(`docker images | awk 'NR == 1 {next}{print $1}'`) #容器名
list2=(`docker images | awk 'NR == 1 {next}{print $3}'`) #容器id
list3=(`docker images | awk 'NR == 1 {next}{print $2}'`) #标签


# 格式: 容器名:标签.tar.gz
#echo $list1
#echo ${list1[1]}
for ((i=0;i<${#list1[@]};i++));do
        echo "docker save ${list2[i]} > ${list1[i]}:${list3[i]}.tar.gz"
        `docker save ${list2[i]} > ${list1[i]}.tar.gz`
done