How to download Raspbian image and write it to SD card

Download Raspbian image and write it SD card using as fewer commands as possible.

Download latest minimal Raspbian image without desktop.

$ wget --content-disposition https://downloads.raspberrypi.org/raspbian_lite_latest
--2018-10-28 19:38:12--  https://downloads.raspberrypi.org/raspbian_lite_latest
Resolving downloads.raspberrypi.org (downloads.raspberrypi.org)... 46.235.227.11, 93.93.128.211, 93.93.128.230, ...
Connecting to downloads.raspberrypi.org (downloads.raspberrypi.org)|46.235.227.11|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://downloads.raspberrypi.org/raspbian_lite/images/raspbian_lite-2018-10-11/2018-10-09-raspbian-stretch-lite.zip [following]
--2018-10-28 19:38:12--  https://downloads.raspberrypi.org/raspbian_lite/images/raspbian_lite-2018-10-11/2018-10-09-raspbian-stretch-lite.zip
Reusing existing connection to downloads.raspberrypi.org:443.
HTTP request sent, awaiting response... 302 Found
Location: http://director.downloads.raspberrypi.org/raspbian_lite/images/raspbian_lite-2018-10-11/2018-10-09-raspbian-stretch-lite.zip [following]
--2018-10-28 19:38:12--  http://director.downloads.raspberrypi.org/raspbian_lite/images/raspbian_lite-2018-10-11/2018-10-09-raspbian-stretch-lite.zip
Resolving director.downloads.raspberrypi.org (director.downloads.raspberrypi.org)... 46.235.227.11, 93.93.128.211, 93.93.128.230, ...
Connecting to director.downloads.raspberrypi.org (director.downloads.raspberrypi.org)|46.235.227.11|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 368317240 (351M) [application/zip]
Saving to: '2018-10-09-raspbian-stretch-lite.zip'

2018-10-09-raspbian-stret 100%[===================================>] 351.25M  1.96MB/s    in 2m 59s

2018-10-28 19:41:12 (1.96 MB/s) - '2018-10-09-raspbian-stretch-lite.zip' saved [368317240/368317240]

Alternatively, download standard Raspian image that includes dektop environment.

$ wget --content-disposition https://downloads.raspberrypi.org/raspbian_latest
--2018-10-28 19:42:24--  https://downloads.raspberrypi.org/raspbian_latest
Resolving downloads.raspberrypi.org (downloads.raspberrypi.org)... 46.235.227.11, 93.93.128.211, 93.93.128.230, ...
Connecting to downloads.raspberrypi.org (downloads.raspberrypi.org)|46.235.227.11|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://downloads.raspberrypi.org/raspbian/images/raspbian-2018-10-11/2018-10-09-raspbian-stretch.zip [following]
--2018-10-28 19:42:24--  https://downloads.raspberrypi.org/raspbian/images/raspbian-2018-10-11/2018-10-09-raspbian-stretch.zip
Reusing existing connection to downloads.raspberrypi.org:443.
HTTP request sent, awaiting response... 302 Found
Location: http://director.downloads.raspberrypi.org/raspbian/images/raspbian-2018-10-11/2018-10-09-raspbian-stretch.zip [following]
--2018-10-28 19:42:24--  http://director.downloads.raspberrypi.org/raspbian/images/raspbian-2018-10-11/2018-10-09-raspbian-stretch.zip
Resolving director.downloads.raspberrypi.org (director.downloads.raspberrypi.org)... 46.235.227.11, 93.93.128.211, 93.93.128.230, ...
Connecting to director.downloads.raspberrypi.org (director.downloads.raspberrypi.org)|46.235.227.11|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1431204144 (1.3G) [application/zip]
Saving to: '2018-10-09-raspbian-stretch.zip'

2018-10-09-raspbian-stret 100%[===================================>]   1.33G  2.40MB/s    in 11m 2s

2018-10-28 19:53:26 (2.06 MB/s) - '2018-10-09-raspbian-stretch.zip' saved [1431204144/1431204144]

Extract image to the standard output and write it your SD card at the same time.

$ unzip -p 2018-10-09-raspbian-stretch-lite.zip | sudo dd of=/dev/mmcblk0 oflag=sync status=progress bs=4M
1859059712 bytes (1,9 GB, 1,7 GiB) copied, 70 s, 26,6 MB/s 
0+14208 przeczytanych rekordów
0+14208 zapisanych rekordów
1866465280 bytes (1,9 GB, 1,7 GiB) copied, 70,2763 s, 26,6 MB/s

Additional notes

I have used InfoZIP's unzip application provided by the unzip package.

$ unzip -v
UnZip 6.00 of 20 April 2009, by Debian. Original by Info-ZIP.

Latest sources and executables are at ftp://ftp.info-zip.org/pub/infozip/ ;
see ftp://ftp.info-zip.org/pub/infozip/UnZip.html for other sites.

Compiled with gcc 6.2.1 20161124 for Unix (Linux ELF).

UnZip special compilation options:
        ACORN_FTYPE_NFS
        COPYRIGHT_CLEAN (PKZIP 0.9x unreducing method not supported)
        SET_DIR_ATTRIB
        SYMLINKS (symbolic links supported, if RTL and file system permit)
        TIMESTAMP
        UNIXBACKUP
        USE_EF_UT_TIME
        USE_UNSHRINK (PKZIP/Zip 1.x unshrinking method supported)
        USE_DEFLATE64 (PKZIP 4.x Deflate64(tm) supported)
        UNICODE_SUPPORT [wide-chars, char coding: UTF-8] (handle UTF-8 paths)
        LARGE_FILE_SUPPORT (large files over 2 GiB supported)
        ZIP64_SUPPORT (archives using Zip64 for large files supported)
        USE_BZIP2 (PKZIP 4.6+, using bzip2 lib version 1.0.6, 6-Sept-2010)
        VMS_TEXT_CONV
        WILD_STOP_AT_DIR
        [decryption, version 2.11 of 05 Jan 2007]

UnZip and ZipInfo environment options:
           UNZIP:  [none]
        UNZIPOPT:  [none]
         ZIPINFO:  [none]
      ZIPINFOOPT:  [none]