Some very useful bash scripting tips for testing the output of a program.

This simple shell script will test your Internet connection and then tell you if it is up or not. wgetvar=$(wget -q –tries=3 –timeout=20 –spider http://google.com)   if [ $? -eq ‘0’ ] then echo "Internet is up." else #some logging echo "Internet is down.." fiwgetvar=$(wget -q –tries=3 –timeout=20 –spider http://google.com) if [ $? -eq ‘0’ … Read more

Check the status of your laptop battery with Powershell on Windows.

This simple one liner will print the battery status of your laptop battery in percent. This shows that I have 48% battery charge remaining. PS C:\> (Get-WmiObject -Class Win32_Battery).estimatedchargeremaining 48PS C:\> (Get-WmiObject -Class Win32_Battery).estimatedchargeremaining 48 Run it like this to get all of the information about your laptop battery. PS C:\WINDOWS\system32> (Get-WmiObject -Class Win32_Battery)   … Read more

Show interface status with the command line on a Cisco switch.

The show interface brief command, issued at the elevated command prompt will show the status of all ports on the switch/router and also show your vlan interfaces you have created. tyrion#show ip interface brief Interface IP-Address OK? Method Status Protocol Vlan1 unassigned YES NVRAM up down Vlan2 172.18.31.128 YES NVRAM up up GigabitEthernet0/1 unassigned YES … Read more