onehungrygeek / custom-bashrc-prompt

Custom .bashrc with Git status, quick weather, currency conversion and more.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Custom .bashrc with Git status, current tech news, random quote, current weather, live currency conversion, and more.

My System

  • Open .bashrc file in your favorite editor. (Try: gedit ~/.bashrc)
  • Add the above code to the end of your .bashrc file. Save the file and exit.
  • Run source ~/.bashrc in terminal to see changes.

Requirements for currency conversion and quote fetch:

Download and install jq by visiting this link or simply type the command below in your bash:

sudo snap install jq

Special Characters for customizing bash prompt:


Git status and branch info:

The prompt automatically shows the current git status and branch information with custom colors in the bash if it detects the current directory to be a git repository. Also, the icon status changes based on git status and branch name. The prompt_git() function is used to enable git information on your working directory. (Feel free to remove it and related inserts if you want.)


External IP check:

You can check your external IP by executing the command xip.


News:

(Credits to Alvin Lin's getnews.tech)

You can get the latest news from various different sources by simply typing news. My favorite default list of sources is google-news, hacker-news, mashable, polygon, techcrunch, techradar, the-next-webt, the-verge, and wired-de. Find other sources by typing curl getnews.tech/sources

Below screenshot is a short example. The script by default displays 20 articles from all the above listed favorite news sources. Feel free to change it in the .bashrc under news function


Random quote

You can view a random quote by typing the command quote.


Currency conversion:

You can quickly check what the live currency conversion rate is for any currency. This API converts from US Dollars (USD). The default is set to INR (Indian Ruppees).

Note: Please check the .bashrc and replace the INR with your favorite currency code

Use cases (check image below):

  • Check currency conversion from USD to favorite currency (Default: INR)
  • Convert certain amount from USD to favorite currency(Default: INR)
  • Convert certain amount from USD to any other currency


Weather info:

(Credits to Igor Chubin's wttr.in)

You can check weather for your current city by executing the command weather. You can also check current weather for any other city by typing weather "CityNameHere" like weather "San Jose"


Directory creation and direct cd:

You can quickly create a directory and also jump into that created directory at the same time using the command mkcdir <directory_name> instead of the standard mkdir <directory_name>.

About

Custom .bashrc with Git status, quick weather, currency conversion and more.


Languages

Language:Shell 100.0%