wget: downloaded file name
wget --server-response -q -O - "https://very.long/url/here" 2>&1 | grep "Content-Disposition:" | tail -1 | awk 'match($0, /filename=(.+)/, f){ print f[1] }' )
This is the correct version as there are may be several 301/302 redirects and finally a Content-Disposition:
header to set the file name
Guessing file name based on URL is not always correct.