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:
weather
For 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]