In the midst of all my testing and what not, the network goes down all the time in my various VM’s. Being lazy, I couldn’t stand having to manually restart the network every time I changed something. Last week when I was in Austin jcran showed me the value of keyboard shortcuts in Linux. Because I couldn’t be bothered to even click a button to open a terminal, he showed me how he mapped it to Alt-F3, which is awesome. After that I thought it couldn’t be that hard to restart the network with the same idea.
First off, I wrote a little script:
I knew the pesky terminal command I needed to run was:
sudo /etc/init.d/networking restart
So instead of having to open a terminal to do this every time, I now had a script to do it for me. I saved this script as network_restart.sh to my /home directory.
Next I went to my keyboard shortcuts:
From here, I created a new shortcut.
I made the name of my shortcut network_restart.
For the shortcut link, I put:
/home/<my home folder>/network_restart.sh
Now that I had my shortcut saved, I clicked on where it says “disabled” and typed:
Ctrl Alt Home
Now my script was mapped to the Ctrl Alt Home shortcut. You can map it to whatever you want, just make sure it isn’t already mapped to something else.