The Issue:
If you enter iwconfig into the terminal, you might see a line saying ‘Power Management:on’ like in the picture below. Power management prioritizes battery life over Internet speed, which seems like a logical fallacy on someone’s part. There’s a quick way and a long way to correct this problem. But if your’s says Power Management:off, don’t bother reading this. You’ve been blessed by Linus Torvalds.
The Quick Way:
sudo iwconfig wlp6s0 power off
That’s the command that gives me fast Internet. But for you it might be different. Enter iwconfig and copy what it says in the left column next to IEEE. Replace wlp6s0 with whatever yours says and enter the command. Now remember to do this every time you boot your computer or try out the long way.
The Long Way:
sudo gedit /etc/bash.bashrc
Just like in Quick Tip #2, scroll down to the bottom and don’t mess with the code that’s there. The following shell script should be the absolute last thing in this file.
#wireless fix
iwconfig > iwconfig.txt
clear
if grep -q Power\ Management:on 'iwconfig.txt'; then
echo iwconfig power management is currently on
sudo iwconfig wlp6s0 power off
echo iwconfig power management is now off
fi
Don’t forget to replace wlp6s0 with whatever yours is named, just like in the quick way. Save that file and from now on, you will be prompted to enter your password the first time you open your terminal. This is so you can give root privileges to the command “sudo iwconfig wlp6s0 power off” and turn off Power Management.
The Deets:
For those of you that would rather know exactly what that script does instead of blind copy and pasting, here’s my line-by-line
Line 1: > specifies where output goes in Shell. Here, > puts iwconfig output into the text file iwconfig.txt
Line 2: clear clears extra output from being displayed in the terminal
Line 3: There’s a couple things going on here:
- if – starts an statement. If this, do the following.
- grep – grep searches a text file for a string (a word). In this case it searches iwconfig.txt
- -q – this stops grep from outputting other things to the terminal. This argument is optional
- Power\ Management:on – This is the string we are searching for. Since Shell uses white spaces to separate arguments, ‘\ ‘ denotes a white space inside one argument.
- ‘iwconfig.txt’ – this denotes the file grep is going to search.
- ; – marks the end of the condition needed to trigger the if statement
- then – denotes what to do when the if statement occurs
Line 4 and 6: echo prints everything following it in the terminal. Like a note
Line 5: This turns of power management, just like above.
Line 6: fi simply ends an if statement in Shell (if is fi backwards, how clever).