MLK Tools


MLK Tools

These are a set of scripts I’ve developed over the years during my time working as UNIX-SysAdmin, in an attempt to make my life easier because I’m “lazy” (I do prefer writing 1000 lines of code than repeating the same command line twice…). I’m still engaged as UNIX-SysAdmin so I think that these utils might be usefull for some other fellows. To tell the truth, by now they are a front-end for some other UNIX commands, such as tar + gzip, or even for programms developed by others. Whenever I have time, I’ll re-code almost everything to make it more “independant”. The tools were/are developed using the Korn-shell which is, I think, a good way for achieving things using system-independant tools; so you don’t need to have Perl or a C/C++ compiler installed on your box, althought I’m sure that someone would be willing to port this Ksh-stuff to either Perl, Python or any other higher-level programming language. If you do so, please let me know! That would save me some hours of coding :-) I had to put a name to the whole stuff, so I choosed MLK, which is my family name without the vowels :-) and is not pronounced [milk] by the way and has nothing to do with it, even when I created the big fonts on the front page using The GIMP and applying the “bovination effect” to them. They have been featured on Sun’s BigAdmin (update: now Oracle’s BigAdmin):

Disclaimer This set of utilities is distributed on an “AS IS” basis, with no warranty of any kind. The Author is not to be held responsible for any use or misuse of this product or the result thereof.

License The MLK-Tools are free software released under the GNU General Public License V2 or later.

The Tools

  • tgz: this is the first one I coded some years ago. On those days, the tar command didn’t include support for compressed files (-z option, from ‘man tar’); at least it didn’t on IRIX 5.3 through 6.5.x (SGI). This tool, as you guessed, can be used to create, list and extract contents from a .tar.gz or .tgz file. It’s still shorter than typing “tar -ztvf whatever.tgz” :-)
  • tbz: years later, as the bzip2 utility appeared, I made a tgz-sequel to handle the .tar.bz2 or .tbz2 files and this tool was born. Its use is very similar to tgz.
  • setbackground: to my knowledge, this tool was coded before any window manager, such as 4DWm (IRIX), allowed to set any picture in any format as background/wallpaper. This can be achieved passing some parameters to the image viewer ‘xv’; and that’s what’s this tool is all about
  • mp3towav: leaving legal issues aside, when I downloaded one or some audio files in MP3 format and I wanted to burn them into a CD, I should use the WAV format, for example. There’s a nice tool for UNIX/Linux called mpg123 by Michael Hipp that, from version 0.59r, converts MP3 to WAV. Because there are some parameters I had to enter for the conversion to work, I did this util to make it easier/faster, and also added some features for batch processing, etc.
  • mmove: from time to time I needed to change the files’ extensions. That was not a problem when they where 2 or 3 files but some other times I found up to 200 files with the wrong extension; for example: .mpe instead of .mp3. In fact, ‘mmove’ stands for ‘multiple move’. Beware of the existance of another ‘mmove’, which is a command from the Mtools used to move or rename an MS-DOS file or subdirectory (pasted from the ‘man mmove’-headers :-) ).
  • space2underscore: sometines I stumbled with filenames containing whitespaces. Some scripts of mine already contained a little function to convert spaces into underscores but I thought that making it a separate tool would be useful as well. Filenames such as “my file number one.ext” will become “my_file_number_one.ext”.
  • zombiewatchdog: every time in a while one or more zombie/defunct processes appeared on my systems after a long uptime. They didn’t represent a big menace as I could live along with them for, say, a week. I knew that it was a certain application causing those zombies, so I made this little script to watch for them and kill them when needed, either automatically or manually; both functions can be done passing the right option to the script. The best way to run it is putting it on a user’s crontab with enough priviledges to kill processes.

Installation Note:

To avoid conflicts with other utils, the MLK-Tools will all install with the mlk-prefix, so you will end up with, for example: mlkmmove, mlktbz, mlkmp3towav, etc. The MLK-Tools are provided with an installer, also developed in Ksh, so you can put them whereever you want in your system.
The MLK Tools require the following extra commands/utils to be installed on your system:

MLK Tools Quick Installation Guide

The installation procedure for the MLK-Tools is very straight forward.
The simplest way to install the tools is to execute the ‘mlktools_install’ script provided in the package, which will do the hard job for you :-)
For example:
     $ mlktools_install /usr/local/mlktools
     it will install the tools under /usr/local/mlktools, which also is the default target directory if you don’t specify anything.
The installer will check for other utils needed for the MLK-tools to work and will warn you when a problem arises. If everything goes fine (why shouldn’t it?) these tools will be installed under the default directory unless you specify something else.
Final (optional) step: include the directory you just created in your PATH. A better way is to include it on your shell’s configuration file. After that you will end up with some mlk-prefixed utils. There are symbolic links to non-prefixed filenames so you can also use, for example: tgz, mmove, setbackground, grpm, etc.
Be aware of the existance of another mmove and tgz. The former is provided with the Mtools and the latter comes in some (if not all) Linux distributions but, AFAIK/IMHO, offers less functionality than mlktgz :-) [BTW – when I created mlktgz I had not heard of tgz before].