Mac 记录之 终端隧道配置

本文详细介绍了如何在Mac上配置终端隧道,包括环境支持、Bash和Zsh终端的代理设置,以及如何查看配置和使用curl命令验证。同时,也提到了通过设置环境变量来配置其他工具的代理模式。

配置

环境支持(开启隧道, 确认端口)

在这里插入图片描述

终端配置

  • Bash

查看配置文件

vim ~/.bash_profile

文件末尾添加代理服务器信息

 # proxy (1080为上方sock端口号,请根据各自设备填写)
 alias proxy='export all_proxy=socks5://127.0.0.1:1080'
 alias unproxy='unset all_proxy'

重置配置

 source ~/.bash_profile
  • zsh终端

查看配置文件

vim ~/.zshrc

文件末尾添加代理服务器信息

 # proxy (1080为上方sock端口号,请根据各自设备填写)
 alias proxy='export all_proxy=socks5://127.0.0.1:1080'
 alias unproxy='unset all_proxy'

重置配置

 source ~/.zshrc

查看配置

使用curl命令查看终端ip

# ipinfo.io 方式
curl ipinfo.io
# https://ip.cn 方式
curl https://ip.cn
# cip.cc 方式
curl cip.cc
# myip.ipip.net 方式
curl myip.ipip.net
# ifconfig.me 方式
curl ifconfig.me
# http://members.3322.org/dyndns/getip 方式
curl http://members.3322.org/dyndns/getip
  • 开启代理并查看代理
# 开启代理
proxy

# 查看IP
curl ipinfo.io

# 返回结果示例
  • 关闭代理模式
# 关闭代理
unproxy

# 查看IP
curl ipinfo.io

# 返回结果示例

其他工具的配置

  • 在命令行中输入一下命令,添加临时环境变量
export http_proxy=socks5://127.0.0.1:1080
export https_proxy=socks5://127.0.0.1:1080
  • 设置git环境变量
git config –global http.proxy 'socks5://127.0.0.1:1080'
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值