一些常用命令


一些常用命令的集合,方便复制粘贴,免得手敲

网络类

设置代理

ip=127.0.0.1 && port=1080 && export http_proxy="http://$ip:$port/" && export https_proxy="http://$ip:$port/" && git config --global http.proxy "http://$ip:$port" && git config --global http.proxy "http://$ip:$port"
ip=proxy.dopwn.cn && port=8080 && export http_proxy="http://$ip:$port/" && export https_proxy="http://$ip:$port/" && git config --global http.proxy "http://$ip:$port" && git config --global http.proxy "http://$ip:$port"

用于内网

ip=proxy.dopwn.cn && port=8080 && export http_proxy="http://$ip:$port/" && export https_proxy="http://$ip:$port/" && git config --global http.https://github.com.proxy "http://$ip:$port"

dockerfile

ARG http_proxy=http://proxy.dopwn.cn:8080 https_proxy=http://proxy.dopwn.cn:8080 no_proxy=127.0.0.1,/var/run/docker.sock

安装类

oh-my-zsh

sh -c "$(curl -fsSL https://raw.githubusercontent.com/chnxyzz/oh-my-zsh/master/tools/install.sh)";

docker

sudo apt-get install docker.io;

sudo curl -sSL https://get.daocloud.io/docker | sh;

sudo usermod -aG docker $USER;

python3 -c "$(curl -fsSL https://raw.githubusercontent.com/chnxyzz/linux_install/master/docker/docker_proxy.py)"

清除已经退出的容器

docker rm -f $(docker ps -a|grep Exited|cut -d ' ' -f  1)

gitlab-runner

curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.deb.sh | sudo bash

apt-get install -y gitlab-runner;

gitlab-runner registry

sudo usermod -aG docker gitlab-runner;

换源类

dockerfile ubuntu && debian

RUN sed -i 's/security.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.list && sed -i 's/archive.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.list && sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list && sed -i 's/security.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list

ubuntu

sed -i 's/security.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.list && sed -i 's/archive.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.list
apt-get update;

centos

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup;
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo;
yum makecache;

centos-epel

curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

debian

sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list;
sed -i 's/security.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list;
apt-get update;

parrot

sed -i "s/deb.parrot.sh/mirrors.bfsu.edu.cn/g" /etc/apt/sources.list.d/parrot.list;
apt-get update;

kali

sed -i "s/http.kali.org/mirrors.aliyun.com/g" /etc/apt/sources.list;
apt-get update;

npm

npm config set registry https://registry.npm.taobao.org

python

python -m pip install -i http://mirrors.aliyun.com/pypi/simple 

go

go env -w GOPROXY=https://mirrors.aliyun.com/goproxy/,direct

Dockerfile类

时间地区

RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
RUN echo 'Asia/Shanghai' >/etc/timezone

输入中文

ENV LC_ALL C.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV TERM screen

Bug修复类

python2.7 jupyter

LANG=zn python -m jupyter notebook

一键推送

hexo blog

hexo clean && hexo g && hexo s && hexo d

git

git add . && git commit -m "new" && git push

dockerfile pip换源

RUN pip install -U pip && \
    pip config set global.index-url http://mirrors.aliyun.com/pypi/simple && \
    pip config set install.trusted-host mirrors.aliyun.com

文章作者: xyzz
文章链接: http://www.xyzzpwn.top
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 xyzz !
 本篇
一些常用命令 一些常用命令
一些常用命令的集合,方便复制粘贴,免得手敲 网络类设置代理ip=127.0.0.1 && port=1080 && export http_proxy="http://$ip:$port/&quo
下一篇 
一台用于即时克隆的母服务器的基本配置 一台用于即时克隆的母服务器的基本配置
简介对于每种服务器都做一个母服务器,在需要的时候通过instant clone进行快速复制留一个记录,每次做母机按这个整合脚本就行现在用的是ubuntu server 20.04.01,其他的应该替换参数什么的就OK了对于母服务器就有如下要
  目录