Custom .bashrc with Git status, current tech news, random quote, current weather, live currency conversion, and more.
- 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.
Download and install jq
by visiting this link or simply type the command below in your bash:
sudo snap install jq
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.)
You can check your external IP by executing the command xip
.
(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
You can view a random quote by typing the command quote
.
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
(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"
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>
.