Teknologi

How to Set Proxy Settings on Linux command line or Terminal

In a Linux Like operating system, we have the variables like http_proxy,ftp_proxy, and https_proxy through which we can access the Internet via proxy on Linux console.

All of the above mentioned variables are can be used with tools like elinks, wget, lynx, rsync, and others.

I am assuming Linux servers that are behind the proxy servers and can get the Internet connection only via proxy settings.

 

Proxy Settings on Command Line

Example 1: Access http base sites via proxy, use below variable.

Syntax:

# export http_proxy=http://[proxy-server-ip-or-dns-name]:[Port-Number]

Example:

# export http_proxy=http://proxy.thegeekdiary.com:8080

Example 2: Password Protect Proxy Settings.

Syntax:

# export http_proxy=http://USERNAME:PASSWORD@[proxy-server-ip-or-dns-name]:PORT

Example:

# export http_proxy=http://nsit:*****@proxy.thegeekdiary.com:8080/

Using Above Command we have set the proxy setting along with user name and password.

Example 3: To access secure sites(https) via proxy, set below variable.

Syntax:

# export https_proxy=http://[proxy-server-ip-or-dns-name]:[Port-Number]

Example:

# export https_proxy=http://proxy.thegeekdiary.com:8080/

Example 4: To access ftp based sites via Proxy, set the below variable:

Syntax:

# export ftp_proxy=http://[proxy-server-ip-or-dns-name]:[Port-Number]

Example:

# export ftp_proxy=http://proxy.thegeekdiary.com:8080/

Note: As these variables are declared for the particular session, to set it permanently, define these variables in the file:

# vi /etc/bash.bashrc 
export http_proxy=http://proxy.thegeekdiary.com:8080/
export ftp_proxy=http://proxy.thegeekdiary.com:8080/
https_proxy=http://proxy.thegeekdiary.com:8080/

Example 5: Proxy Settings in APT on Ubuntu Linux.

# vi /etc/apt/apt.conf
Acquire::http::Proxy "http://[proxy-server-ip-or-dns-name]:[Port-Number]";

Example 6: Proxy Settings for RSYNC:
Syntax:

# export RSYNC_PROXY="http://[proxy-server-ip-or-dns-name]:[Port-Number]”

Example:

# export RSYNC_PROXY="http://proxy.thegeekdiary.com:8080”

 

 

ryan

Recent Posts

Jadwal Imsak dan Buka Puasa Ramadhan 2025 Kota Serang Selama Sebulan

Berikut jadwal imsak dan buka puasa Ramadhan 2025 di Kota Serang dari tanggal 1 Ramadhan -…

1 minggu ago

Jadwal Resmi Awal Puasa Ramadan 2025 Pemerintah, NU, Muhammadiyah

Jakarta - Pemerintah telah menetapkan awal Ramadan 2025 berdasarkan hasil sidang isbat oleh Kemenag. Begitu pula dengan organisasi masyarakat…

1 minggu ago

Meta AI Ditanya Luas Kebakaran Los Angeles, Hasilnya Mengejutkan Sama dengan Luas Gaza

Siapa sangka, salah satu warganet justru mendapat informasi tak terduga yang berasal dari Meta AI.…

2 bulan ago

Tebak-tebakan pelesetan kata ini lucu abis, awas ketawa ngakak

Ketika menjalani rutinitas sehari-hari tentu saja kamu pernah merasa suntuk atau jenuh. Supaya kamu bisa…

2 bulan ago

Kapal China Diduga Biang Kerok Internet Mati Total di Berbagai Negara

Sebuah kapal kargo komersial China diduga sengaja menyeret jangkarnya untuk memotong kabel bawah laut yang…

3 bulan ago

Ini Sumber Kekayaan Nabi Sulaiman, Sungguh di Luar Dugaan

Nabi Sulaiman dikenal sebagai raja yang kaya raya. Para ilmuwan arkeologi kini mengungkap apa sumber kekayaannya,…

3 bulan ago