[highlighter]
In this section you will find some automation tips and tricks that you can use for your workflow in order to make you a more productive programmer.
Virtual Box and Samba Shares
If you are running a VirtualBox instance from the GUI, and then mounting the samba share. This is costing you time and effort. Automate this with a simple command to startup your workflow and stop your workflow.
First you need to create an alias to startup the virtual machine. Before you run the following command on the terminal make sure that you change the value of <VMNAME>
to the name of the VM that you want to startup.
echo "alias vmwww='VBoxManage startvm \"\" --type headless'" >> ~/.bash_profile
Now that you can startup the VM you will need a way to mount a samba share and SSH into the server. Change the <USERNAME>
value to reflect your username, change <DOMAIN OR IP ADDRESS>
to match your domain or ip address, then open your terminal and run the following command. This command will create an alias for www
which will create a directory named www
and mount your samba shares to it, then SSH
you into the virtual machine.
echo "alias www='mkdir ~/Desktop/www && mount_smbfs //@ /www ~/Desktop/www && ssh @ '" >> ~/.bash_profile
Neat! The last part is to be able to turn off the machine, you can do this by creating another alias that un mounts the samba share, deletes the directory, and powers off the virtual machine. First edit the values to reflect your setup and then run this command.
echo "alias uwww='umount ~/Desktop/www && rm -R ~/Desktop/www && VBoxManage controlvm \"\" poweroff'" >> ~/.bash_profile
Don’t forget to tell bash about the changes.
source ~/.bash_profile
At this point you will have the following commands available to you.
* vmwww
starts VM
* www
mounts shares and SSH’s into VM
* uwww
unmounts samba share and powers off VM
Terminal Aliases
The following alias improves the standard ls
command by displaying all files included hidden files, in a long listing format that is human readable with ignored groups.
echo "alias ll='ls -lahG'" >> ~/.bash_profile
Don’t forget to tell bash about the changes.
source ~/.bash_profile
I always had a passion for the field of STEM (Science, Technology, Engineering, and Math) and I knew I wanted to do something to make a difference in the world. I just didn’t know where to start. I was an immigrant in a new country, grew up in a tough environment, and wasn’t sure how… Read More