Ubuntu add proxy with username, password and port — July 26, 2017

Ubuntu add proxy with username, password and port

I have tested this with Ubuntu 14.04
First go to system settings > Network > Network Proxy
and fill ‘Proxy’ and ‘Port’
Then click on ‘Apply system wide’

Now open apt.conf file

gksudo gedit /etc/apt/apt.conf

and add this

Acquire::http::proxy "http://username:password@proxy_ip:port/";
Acquire::https::proxy "https://username:password@proxy_ip:port/";
Acquire::ftp::proxy "ftp://username:password@proxy_ip:port/";
Acquire::socks::proxy "socks://username:password@proxy_ip:port/";

Take care of every semi-colon and slash. Save this,

Now open this ‘environment’ file. For this file you may need sudo password

nano /etc/environment

and add this

http_proxy="http://username:password@proxy_ip:port/"
https_proxy="https://username:password@proxy_ip:port/"
ftp_proxy="ftp://username:password@proxy_ip:port/"
socks_proxy="socks://username:password@proxy_ip:port/"

save file and then logout user to check settings. Use this command

set | grep -i proxy

and check if you see any variables now. If yes then you have successfully enabled proxy.
Now open firefox and check if it asks for password on startup. Then enter proxy username and password and Boom :).

Ubuntu wget scrap a website — July 23, 2017

Ubuntu wget scrap a website

$ wget \
     --recursive \
     --no-clobber \
     --page-requisites \
     --html-extension \
     --convert-links \
     --restrict-file-names=windows \
     --domains website.org \
     --no-parent \
         www.website.org/tutorials/html/

This command downloads the Web site www.website.org/tutorials/html/.

The options are:

  • –recursive: download the entire Web site.
  • –domains website.org: don’t follow links outside website.org.
  • –no-parent: don’t follow links outside the directory tutorials/html/.
  • –page-requisites: get all the elements that compose the page (images, CSS and so on).
  • –html-extension: save files with the .html extension.
  • –convert-links: convert links so that they work locally, off-line.
  • –restrict-file-names=windows: modify filenames so that they will work in Windows as well.
  • –no-clobber: don’t overwrite any existing files (used in case the download is interrupted and
    resumed).

You can read of original resource.

Ubuntu install missing packages — July 18, 2017
Ubuntu find file in directory and get file information — July 16, 2017
Ubuntu delete directories or files command line — July 13, 2017

Ubuntu delete directories or files command line

To delete all file in a directory

rm /path/to/directory/*

To remove the folder with all its contents(including all interior folders):

rm -rf /path/to/directory

To remove all the contents of the folder(including all interior folders) but not the folder itself:

rm -rf /path/to/directory/*

To remove all the “files” from inside a folder(not removing interior folders):

rm -f /path/to/directory/*

rm – stands for “remove”
-f – stands for “force” which is helpful when you don’t want to be asked/prompted if you want to remove an archive, for example.
-r – stands for “recursive” which means that you want to go recursively down every folder and remove everything.

ubuntu check free disk space command line — July 12, 2017
Ubuntu create zip and exclude directories —