---
title: "Google Sunrise Sunset From Terminal"
description: "As Google starts Sunrise and Sunset query, i tried these silly bash functions, make it more better. Prerequisites in JS fast."
url: "https://h3manth.com/scribe/google-sunrise-sunset-terminal/"
canonical_url: "https://h3manth.com/scribe/google-sunrise-sunset-terminal/"
markdown_url: "https://h3manth.com/scribe/blog/google-sunrise-sunset-terminal.md"
publishDate: "2010-06-28T00:00:00.000Z"
author: "Hemanth HM"
category: "linux"
tags: ["ubuntu","git","bash","web"]
word_count: 104
reading_time_minutes: 1
x_markdown_tokens: 292
content_signal: "ai-train=yes, search=yes, ai-input=yes"
---

# Google Sunrise Sunset From Terminal

> As Google starts Sunrise and Sunset query, i tried these silly bash functions, make it more better. Prerequisites in JS fast.

As Google starts Sunrise and Sunset query, i tried these silly bash functions, make it more better.

**Prerequisites: curl,html2text** _sudo apt-get install curl html2text_

**$ git clone git@gist.github.com:456310.git** and edit.
    
    
    function sunrise() { curl -sA Mozilla http://www.google.com/search?q=sunrise+$1 \
    | html2text -width 80 \
    | sed -n '10s/^ \{45\}//p';}
    
    function sunset() { curl -sA Mozilla http://www.google.com/search?q=sunset+$1 \
    | html2text -width 80  \
    | sed -n '/from now/s/^ \{44\}//p'; }
    

**Paste the above code in your ~/.bashrc or anywhere accessible**

**Example usage:**` hemanth@ubuntu:/tmp$ sunrise bangalore 3 hours 44 minutes from now hemanth@ubuntu:/tmp$ sunset bangalore 16 hours 37 minutes from now `

**Do comment you suggestions below**
