常用操作

Saturday, Oct 28, 2017 | 1 minute read | Updated at Saturday, Oct 28, 2017

@
常用操作
  • 代理设置
  • git 操作
  • 文件夹比较
  • flash 分区
  • 阻止软件更新
  • docker设置国内镜像
  • linux语言环境设置

代理设置

apt-get

cat /etc/apt/apt.conf
# 末尾;不能缺少
Acquire::http::proxy "http://10.167.196.133:8080/";
#Acquire::ftp::proxy "ftp://127.0.0.1:8000/";
#Acquire::https::proxy "https://127.0.0.1:8000/";

docker

cat /usr/lib/systemd/system/docker.service 
# 路径可以通过systemctl status docker查看[Service]
Environmment=http_proxy=http://10.167.196.133:8080/

git http及git协议代理设置

# git config -l
http.proxy=http://10.167.196.133:8080/
core.gitproxy=/usr/local/bin/git-proxy.sh

corkscrew代理

  1. 安装corkscrew
apt-get install corkscrew

2 设置代理脚本/usr/local/bin/git-proxy.sh

#/bin/bash
CORKSCREW=`which corkscrew`
$CORKSCREW 10.167.196.133 8080 $1 $2 
#$CORKSCREW 10.167.196.133 8080 $1 $2 /usr/local/bin/authfile

3. `chomod +x /usr/local/bin/git-proxy.sh`
4. 设置授权文件`/usr/local/bin/authfile`
```plain
username:pwd
  1. 配置git config
git config [--global] http.proxy http://[user:pwd@]10.167.196.133:8080/
git config [--global] core.gitproxy '"proxy-command" for example.com'

git 操作

git remote 修改源

git commit -m "Change repo." # 先把所有为保存的修改打包为一个commit
git remote remove origin # 删掉原来git源
git remote add origin [YOUR NEW .GIT URL] # 将新源地址写入本地版本库配置文件
git push -u origin master # 提交所有代码

或者

git remote set-url [branch_name] remote_git_address

文件夹比较

diff -Nrq a b

flash 分区

cat /proc/mtd

阻止软件更新

# Hold a package:
sudo apt-mark hold <package-name>

# Remove the hold:
sudo apt-mark unhold <package-name

docker设置国内镜像(已过期)

# docker 国内镜像
--registry-mirror=http://hub-mirror.c.163.com

linux语言环境设置

# 设置语言环境
export LC_ALL=zh_CN.UTF-8
# 已安装语言环境查看
locale -a

© 2016 - 2025 Caisong's Blog

🌱 Powered by Hugo with theme Dream.

About Me

大龄程序员,喜欢折腾各种环境部署、软件应用。

博客记录日常。