Get Weather in Your Terminal by using wttr.in
To edit the PowerShell profile, follow these steps:
- Open Notepad or your preferred text editor.
- Navigate to:
C:\Users\Username\Documents\PowerShell\ - Open:
Microsoft.PowerShell_profile.ps1 - Add this function:
function weather {
Invoke-RestMethod https://wttr.in
}- ๐พ Save the file.
- ๐ Reload the profile by running:
. $PROFILEโ Now, check the weather with:
weatherFor Bash users, add the following to your bash profile (e.g., ~/.bashrc or ~/.bash_profile):
# Weather Function
_weather(){
curl -s -L wttr.in/$@ | less -R
}
alias weather='_weather'๐พ Reload the profile with:
source ~/.bashrcโ Now, you can view the weather by typing:
weather , or weather [location]