Bash - Follow a short-url to it's source

function traceurl() { if [[ -n $1 ]]; then curl --location --head $1; else echo 'Not a short URL'; fi }; traceurl http://goo.gl/pQehoM : ' HTTP/1.1 301 Moved Permanently Strict-Transport-Security: max-age=10886400; Content-Type: text/html; charset=UTF-8 Cache-Control: no-cache, no-store, max-age=0, must-revalidate Pragma: no-cache Expires: Mon, 01 Jan 1990 00:00:00 GMT Date: Thu, 21 Jul 2016 05:22:19 GMT Location: http://www.codepad.co/ X-Content-Type-Options: nosniff X-Frame-Options: SAMEORIGIN X-XSS-Protection: 1; mode=block Server: GSE Transfer-Encoding: chunked Accept-Ranges: none Vary: Accept-Encoding HTTP/1.1 301 Moved Permanently Server: nginx Date: Thu, 21 Jul 2016 05:22:19 GMT Content-Type: text/html Content-Length: 178 Connection: keep-alive Location: http://codepad.co/ HTTP/1.1 302 Found Server: nginx Date: Thu, 21 Jul 2016 05:22:19 GMT Content-Type: text/html; charset=iso-8859-1 Connection: keep-alive Location: https://codepad.co/ HTTP/1.1 200 OK Server: nginx Date: Thu, 21 Jul 2016 05:22:19 GMT Content-Type: text/html; charset=UTF-8 Connection: keep-alive Vary: Accept-Encoding X-Powered-By: PHP/7.0.8 Cache-Control: private, must-revalidate pragma: no-cache expires: -1 9 GMT; Max-Age=7200; path=/; domain=.codepad.co; HttpOnly Strict-Transport-Security: max-age=864000 X-Powered-By: PleskLin MS-Author-Via: DAV '

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.