Setting proxy for Windows CMD and Linux Terminal
setting proxy for Windows CMD and Linux Terminal
Linux Terminal:
set http_proxy=http://127.0.0.1:8118
set https_proxy=http://127.0.0.1:8118
set http_proxy=
set https_proxy=
more ref: Setting proxy for apt from terminal
Windows CMD:
format:
set HTTP_PROXY=http://user:password@proxy.domain.com:port
examples:
set HTTP_PROXY=http://127.0.0.1:8118
set HTTPS_PROXY=http://127.0.0.1:8118
Use Privoxy to transfer SOCKS to HTTP/HTTPS or Proxifier to manage the proxy
Brew安装 Install Privoxy on Mac OSX
输入命令:brew install privoxy就ok了。之后修改配置文件/usr/local/etc/privoxy/config,搜索socks5找到下面这一句:
#forward-socks5t / 127.0.0.1:9050 .
复制
其中9050是Tor浏览器提供的本地socks5端口,这句不用管,直接在下面加一句:
forward-socks5 / 127.0.0.1:1080 .
复制
这里1080是本地socks5的端口,记住最后面有一个点号不能少.
另外还能看到默认的一句:
listen-address 127.0.0.1:8118
复制
这表示privoxy只兼听本机的8118端口,如果你希望其他局域网内都可以用这个代理可以修改为:
listen-address 0.0.0.0:8118
复制
开机自启
之前从来没有设置过开机自启,都是需要用到时才用脚本去启动,现在来看太麻烦了。完全可以让他开机启动,用到时去接到8118端口就可以了。
用brew安装完毕后,会看到下面一段话:
==> Installing privoxy
==> Downloading https://homebrew.bintray.com/bottles/privoxy-3.0.26.high_sierra.
######################################################################## 100.0%
==> Pouring privoxy-3.0.26.high_sierra.bottle.1.tar.gz
==> Caveats
To have launchd start privoxy now and restart at login:
brew services start privoxy
Or, if you don't want/need a background service you can just run:
privoxy /usr/local/etc/privoxy/config
复制
如果想设置开机启动的话,只需要:sudo brew services start privoxy就ok了。如果单次启动的话用/usr/local/sbin/privoxy /usr/local/etc/privoxy/config。
备注:这个启动方式和用Privxoy原始安装方式还是有区别的。
验证是否启动
方式一
经过上述操作打开shadowsocks和privoxy后,就需要验证socks5代理转http是否成功。首先看privoxy是否启动起来了,输入ps -ef|grep privoxy可以看到:
501 400 1 0 4:58下午 ?? 0:00.18 /usr/local/Cellar/privoxy/3.0.26/sbin/privoxy --no-daemon /usr/local/etc/privoxy/config
501 402 1 0 4:58下午 ?? 0:00.01 /Users/yanzi/Library/Application Support/ShadowsocksX-NG/privoxy --no-daemon privoxy.config
501 1625 1600 0 6:46下午 ttys001 0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn privoxy
复制
可以看到已经启动成功了。
方式二
输入netstat -an | grep 8118可以看到:
tcp4 0 0 127.0.0.1.8118 *.* LISTEN
复制
也能证明已经ok了。
方式三
最根本的方法莫过于通过8118端口访问baidu了:
wget -e http_proxy=127.0.0.1:8118 www.baidu.com
curl -x 127.0.0.1:8118 www.baidu.com
复制
用wget和curl都是ok的。
终端也能用代理
在~/.zshrc里加上两句:
export http_proxy='http://127.0.0.1:8118'
export https_proxy='http://127.0.0.1:8118'
复制
通过echo $http_proxy要确保其生效.
Setting proxy for Windows CMD and Linux Terminal的更多相关文章
- windows下使用linux terminal
windows下使用linux terminal 1.下载安装包 2.安装 3.解决乱码 0.前言 其实,写这个的目的是怕自己忘了,方便以后配置和分享 1.下载安装包 安装包下载地址: http:// ...
- 干掉cmd:windows下使用linux命令行
对于喜欢用命令行的朋友们,在windows下面使用cmd窗口是不是很不爽?复制不方便?不能随意放大缩小?如果需要多个控制台要多个窗口?....各种不爽 一.基础工具 如果你也不爽,那就对了,所以给大家 ...
- windows cmd 命令和 linux 命令
windows cmd 命令和 linux 命令 常用的内部命令有md.cd.rd.dir.path.copy.type.edit.ren.del.cls.ver.date.time.prompt.常 ...
- [转]linux terminal中使用proxy
转自:http://www.cnblogs.com/JoJosBizarreAdventure/p/5892383.html 在linux terminal中使用代理 方法一: terminal中输入 ...
- Build SSH for Development on Windows Subsystem for Linux
It seems that Windows Subsystem for Linux (WSL) is getting much more mature than the time when it fi ...
- Windows软件在Linux上的等价/替代/模仿软件列表 (抄一个)
Last update: 16.07.2003, 31.01.2005, 27.05.2005 您可在以下网站发现本列表最新版:http://www.linuxrsp.ru/win-lin-soft/ ...
- Windows CMD命令大全(转)
Windows CMD命令大全 命令简介 cmd是command的缩写.即命令行 . 虽然随着计算机产业的发展,Windows 操作系统的应用越来越广泛,DOS 面临着被淘汰的命运,但是因为它运行 ...
- Running ASP.NET Core applications on Windows Subsystem for Linux
Setting up Linux on Windows 10 First thing is to enable Windows Subsystem for Linux. It doesn’t inst ...
- 在eclipse里配置Android ndk环境 适用于windows mac 和linux(转)
在eclipse里配置Android ndk环境 适用于windows mac 和linux(转) 2012-02-27 13:02:16| 分类: android | 标签:java prog ...
随机推荐
- LintCode之左填充
题目描述: 分析:由样例可知,第二个参数表示要返回的字符串的最小长度,所以当给定字符串的长度小于规定字符串最小长度时就在左边填充空格,另外还有一个重载方法leftpad的第三个参数指定左边填充的字符. ...
- 面向对象编程思想(OOP)(转发)
本文我将从面向对象编程思想是如何解决软件开发中各种疑难问题的角度,来讲述我们面向对象编程思想的理解,梳理面向对象四大基本特性.七大设计原则和23种设计模式之间的关系. 软件开发中疑难问题: 软件复杂庞 ...
- mybatis有结果返回null
解决:application.yml 中mybatis此项(解决驼峰及数据库字段有下划线问题) map-underscore-to-camel-case: true 问题: mybatis debug ...
- 下载工具 qBittorrent 使用
官网地址,软件可以在官网上下载. GitHub 源码 知乎的参考链接 qBittorrent 是开源软件,支持用 BT 种子或种子的链接下载,也可以用磁力链接进行下载. 搜索功能 qBittorren ...
- Ubuntu下apt-get 安装apache2、php、mysql后的默认路径
apache: 采用apt-get 在线安装,安装路径应在/etc/apache2目录下 apache配置文件/etc/apache2/apache2.conf Apache模块路径:/usr/sbi ...
- 【ABAP系列】SAP ABAP实现LOG显示的方法
公众号:SAP Technical 本文作者:matinal 原文出处:http://www.cnblogs.com/SAPmatinal/ 原文链接:[ABAP系列]SAP ABAP实现LOG显示的 ...
- poj1182食物链(三类并查集)
动物王国中有三类动物A,B,C,这三类动物的食物链构成了有趣的环形.A吃B, B吃C,C吃A. 现有N个动物,以1-N编号.每个动物都是A,B,C中的一种,但是我们并不知道它到底是哪一种. 有人用两种 ...
- Recurrent Neural Network(1):Architecture
Recurrent Neural Network是在单个神经元上,除了输入与输出外,添加了一条Recurrent回路.也就是说,节点当前的状态将会影响其未来的状态.下式可以表征此关系: st= f(s ...
- CCNA 之 二 OSI七层模型
OSI网际互联 OSI的概念 英文全称Open System Interconnect 开放系统互联参数模型,是由ISO国际标准化组织 定义的.它是个灵活的.稳健的和可互操作的模型,并不是协议,使用来 ...
- [暑假集训Day2T2]走廊泼水节
给定一棵n个点的图上的最小生成树,让你把它补成完全图,使得新图的MST还是给定的MST且边权和最小,输出需要增加的边权和. 设size[i]表示以i号为祖先的并查集的大小. 首先按边权排序,之后在做M ...