Quota prettyfier and getting quota information from Windows
• Ryan Kavanagh
At work I was asked to write a small script that allows users to get their
quota from a Windows machine since apparently Windows doesn’t have an
equivalent to the ‘quota‘ command. All these users also have
accounts on UNIX boxes (running either SunOS 5.8 or Linux), so I figured the
quickest way would be to SSH into one of these and make the output of the
‘quota‘ command easier to read.
This is composed of three parts, the first is a BAT script that calls putty
with the hostname and points to a file with a list of commands to run. The
second is this said list of commands to run. The third (and best part) is a
short Perl script that will take the output of ‘quota -v‘ and
format it depending on whether we’re running Solaris or Linux.
You will have to substitute HOSTNAME.DOMAINNAME.TLD with the
Solaris/Linux box’s hostname. You may also have to change
C:\Program~1\putty.exe with the path to your putty install. Place
the following BAT file wherever. I put it in ‘Quota.bat‘ on the
This calls the Perl script. The rest of the script is to provide the user enough time (15 seconds) to read the output. If we didn’t have this, Putty would exit as soon as the display from quotacheck.pl had been displayed.
Place the following Perl script in /usr/local/bin/quotacheck.pl with executable permissions and you should be good to go.
I, the copyright holder of this work, hereby release the BAT file and the BASH script into the public domain. This applies worldwide. In case this is not legally possible, I grant any entity the right to use the BAT file and the BASH script work for any purpose, without any conditions, unless such conditions are required by law. The Perl script (quotacheck.pl) is released under the terms of the GNU General Public License version 2, or (at your option) any later version.