
Ubuntu에서 명령줄 터미널을 사용할 때 프록시를 끄는 명령줄을 보여줄 수 있습니까?
답변1
다른 답변에서 알 수 있듯이 시스템을 전혀 보지 않는 일부 프로그램이 있으므로 개별적으로 설정해야 할 수도 있습니다. 예를 들어 wget에는 실행 중에 환경 프록시 구성을 무시하거나 조정하는 데 사용할 수 있는 다양한 프록시 옵션이 있습니다. 다음은 시스템 프록시를 설정할 수 있는 여러 영역입니다.
- 내 시스템이 어떻게 보이는지 확인하려면 네트워킹 환경에 맞게 지정된 시스템 구성을 변경해야 합니다.
일부 Linux 시스템에서는 /etc/environment를 사용합니다.
$ cat /etc/environment
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
http_proxy="http://192.168.1.250:8080/"
ftp_proxy="ftp://192.168.1.250:8080/"
https_proxy="https://192.168.1.250:8080/"
다른 사용 환경에는 균일한 단일 설정이 없습니다.
$ env | grep -i proxy
NO_PROXY=localhost,127.0.0.0/8,127.0.1.1
http_proxy=http://192.168.1.250:8080/
FTP_PROXY=ftp://192.168.1.250:8080/
ftp_proxy=ftp://192.168.1.250:8080/
all_proxy=socks://192.168.1.250:8080/
ALL_PROXY=socks://192.168.1.250:8080/
HTTPS_PROXY=https://192.168.1.250:8080/
https_proxy=https://192.168.1.250:8080/
no_proxy=localhost,127.0.0.0/8,127.0.1.1
HTTP_PROXY=http://192.168.1.250:8080/
시스템 시작 시 설정이 자동으로 적용되도록 ~/.bashrc를 확인하겠습니다.
$ man env
$ man set
$ # The file section near the end of the bash manual.
$ man bash
FILES
/bin/bash
The bash executable
/etc/profile
The systemwide initialization file, executed for login shells
/etc/bash.bashrc
The systemwide per-interactive-shell startup file
/etc/bash.bash.logout
The systemwide login shell cleanup file, executed when a login
shell exits
~/.bash_profile
The personal initialization file, executed for login shells
~/.bashrc
The individual per-interactive-shell startup file
~/.bash_logout
The individual login shell cleanup file, executed when a login
shell exits
~/.inputrc
Individual readline initialization file
답변2
일반적인 명령줄 소프트웨어와 HTTP 프록시에 대해 이야기한다고 가정해 보겠습니다.
대부분의 명령줄 도구는 환경 변수에서 이를 선택 HTTP_PROXY
하므로 명령을 실행하기 전에 다음을 수행하십시오.
unset HTTP_PROXY
소프트웨어/플랫폼 간에는 약간의 차이가 있을 수 있으며 필요할 수도 있습니다 unset http_proxy
.
많은 프로그램이 이 정보를 자체 구성 파일에 저장하고 환경을 무시할 가능성이 높으므로 사례별로 이를 해결해야 합니다.
답변3
Bash에서 모든 변수를 한 번에 설정하거나 설정 해제할 수 있습니다.
$ export {http,https,ftp}_proxy="http://proxy-server:port"
$ unset {http,https,ftp}_proxy
$ export {HTTP,HTTPS,FTP}_PROXY="http://proxy-server:port"
$ unset {HTTP,HTTPS,FTP}_PROXY
다음과 같은 바로가기를 추가할 수도 있습니다 ~/.bashrc
.
# Set Proxy
function setproxy() {
export {http,https,ftp}_proxy="http://proxy-server:port"
export {HTTP,HTTPS,FTP}_PROXY="http://proxy-server:port"
}
# Unset Proxy
function unsetproxy() {
unset {http,https,ftp}_proxy
unset {HTTP,HTTPS,FTP}_PROXY
}
.bashrc를 다시 로드하는 것을 잊지 마세요:
$ . ~/.bashrc
또는
$ source ~/.bashrc
자세한 내용은[S] 지옥 해킹.
답변4
export http_proxy=
다음을 실행하여 사라졌는지 확인할 수 있습니다.
echo $http_proxy
빈 줄을 반환해야 합니다.