How to update Cygwin from Cygwin’s command line

cygwin;updates

To search and download a package missed from Cygwin I need to run setup.exe GUI each time, click many times and do other boring things.

Is there a way to do the same from Cygwin's command line directly? Like apt-get tools do.

Best Answer

Take a look here:

Aside from the other things, it gives the following list of options to setup.exe:

Command Line Options:
 -A --disable-buggy-antivirus           Disable known or suspected buggy anti
                    virus software packages during execution.
 -C --categories                        Specify entire categories to install
 -D --download                          Download from internet
 -d --no-desktop                        Disable creation of desktop shortcut
 -h --help                              print help
 -K --pubkey                            Path to extra public key file (gpg format)
 -L --local-install                     Install from local directory
 -l --local-package-dir                 Local package directory
 -n --no-shortcuts                      Disable creation of desktop and start menu
                    shortcuts
 -N --no-startmenu                      Disable creation of start menu shortcut
 -O --only-site                         Ignore all sites except for -s
 -P --packages                          Specify packages to install
 -p --proxy                             HTTP/FTP proxy (host:port)
 -q --quiet-mode                        Unattended setup mode
 -r --no-replaceonreboot                Disable replacing in-use files on next
                    reboot.
 -R --root                              Root installation directory
 -S --sexpr-pubkey                      Extra public key in s-expr format
 -s --site                              Download site
 -U --keep-untrusted-keys               Use untrusted keys and retain all
 -u --untrusted-keys                    Use untrusted keys from last-extrakeys
 -X --no-verify                         Don't verify setup.ini signatures

So setup.exe -P <package name> should do the job. Don't have cygwin right here, so test it to confirm it works as expected.

To search for a package, per:

you can use cygcheck -p:

  cygcheck -p REGEXP
  ...
  -p, --package-query  search for REGEXP in the entire cygwin.com package
                       repository (requires internet connectivity)

which produces output like (example from above site):

$ cygcheck -p 'libexpat.*\.a'
Found 2 matches for 'libexpat.*\.a'.

expat-1.95.7-1            XML parser library written in C
expat-1.95.8-1            XML parser library written in C
Related Question