Often times I’ve been asked while using Linux console / shell, why Linux is so hard that I need to memorize and type this and that command to get things running. Their argument is that in Windows they just need to click here and there, and walla, everything’s done. My usual answer would be, I’m just too used to the command line that it get me do many if not all things faster rather than accomplishing the same task using GUI based programs. User friendly OS definition goes beyond pretty GUI interface and "next" buttons count..
After some time I found out that I need to get things done even faster, especially on repetitive tasks. For this I decided to harness a bit more of Linux shell’s power by writing scripts of some of my common task. The simplest example is the bash script that I use to scan for nearby wireless connections;
#!/bin/bash
watch -n 0.5 sudo iwlist ath0 scan
Basicly it’s just a command with the #!/bin/bash heading, just to identify itself as a bash script. To make things easy for me, I store my scripts in a folder, and make sure the folder is in my $PATH. In my case, i store it in ~/temp/bin . To add the folder to my $PATH, I just add this line to my ~/.bashrc;
PATH=/home/shakir/temp/bin:$PATH
My script’s filename starts with "xx" as prefix, and contains "." shall there be any scripts which share some common stuff. For example, the sample script above is named xxscan, and I also have scripts named xxip.home and xxip.office (this two scripts are used to set IP address for my laptop at home, and office respectively). Why would I do that anyway?
One of the nice feature of a Bash shell (default shell for most Linux distros) is the tab completion. Typing "xx" followed by double tapping <tab> key will list all the programs that start with "xx", which in this case would probably be just my scripts. Further typing "ip" and double tapping <tab> key will leave me with the xxip.home and xxip.office option.
I hope this tip helps and dont forget to chmod +x /path/to/your/script or your script will refuse to execute
Please comment if you have any better ideas regarding to this, and hopefully I’ll be able to come out with $productivity_tips[1] soon








