Turn long commands into a script

A very simple tip for all Linux users out there, if you have a long command which you need to type occasionally, or you have a one off command you think may be helpful, instead of having to type it out all of the time you could very easily add it to a script.

For example this command

ping | while read pong; do echo "$(date +%F_%T) -- $pong"; done

To save me typing it out repeatedly, after you have the line written out press CTRL-x then CTRL-e.  This will load your default editor** and there is your command.  Then you can add your #!shell of choice at the top, save the file and there you have a simple script.

**If you don't have an editor set in your profile then you will need to set it.

I am always interested in feedback so please feel free to add any comments, or you can mail me  here.  If you would like to submit a quick tip  with full credit and links back to your site then also feel free to contact me.  

Why won't my mac sleep?

Get your public IP address from Google