On MovieTome: Captain America in IRON MAN?

Generate a readable UNIX disk free listing

Tags: Operating systems, Guest Contributor, disk, file system, Unix

  • Save
  • Print
  • Digg This
  • 0

Takeaway: TechRepublic asked members to submit their favorite network administration scripts and this is one of the responses. You can use this script to generate a readable UNIX disk free listing.

TechRepublic recently asked members to submit their favorite Network Administration scripts for possible publication. One of the first to make a submission was Milton Ingram. For his effort, Milton earned $100 and the satisfaction of seeing his script published on TechRepublic.


Earn $100 for your admin script


Let us pay you for your original scripts so that we can publish them as downloads on TechRepublic and allow your fellow IT professionals to benefit from your scripting savvy. We only ask that you put in the appropriate comments to your scripts so that it's easy to tell what the script is doing and which variables might need to be customized. Send us your original admin scripts and we'll pay you $100 for each one that we publish as a TechRepublic download.


In their own words

This script is called df2 (See Listing A). Please excuse the Win line splits, it provides a more readable list of your Linux disk usage in Megabytes, which is really handy when you have a RAID attached with lots of disks. df -k never really cut it for me. It (df2) uses awk and should work on any UNIX variant. Everyone that sees it wants a copy. We use it all the time.

Listing A


#!/bin/ksh
# Generate a readable disk free listing
# MWI 0310
#
echo
"=====================================================================
"
echo "File System Report in MB :" `date`
echo
"=====================================================================
"
echo "File System Device        Total       Used      Avail   Capacity
Mounted  "
echo
"=====================================================================
"
df -k | sort -k6 |awk '$1!="swap" && $1!="Filesystem"
{tt+=$2;tu+=$3;tr+=$4;printf "%-20s
%10.2f %10.2f %10.2f %7s      %-16s\n", $1, $2/1024, $3/1024, $4/1024, $5,
$6}
END{printf "\nTotal Storage is     %10.2f %10.2f %10.2f\n", tt/1024,
tu/1024, tr/1024 }'
echo
"=====================================================================
  • Save
  • Print
  • Digg This
  • 0

Print/View all Posts Comments on this article

Admin scripts: Generate a UNIX disk free listingMark W. Kaelin Techrepublic | 11/04/05
Works for Win too..jperout@...  | 11/07/05
I can't get it to work.tomhill@...  | 11/07/05
Script problems and AIX usagehbrady@...  | 11/08/05
Formatting problemMark W. Kaelin Techrepublic | 11/11/05

What do you think?

Article Categories

Security
Security Solutions, IT Locksmith
Networking and Communications
E-mail Administration NetNote, Cisco Routers and Switches
CIO and IT Management
Project Management, CIO Issues, Strategies that Scale
Desktops, Laptops & OS
Windows 2000 Professional, Microsoft Word, Microsoft Excel, Microsoft Access, Windows XP,
Data Management
Oracle, SQL Server
Servers
Windows NT, Linux NetNote, Windows Server 2003
Career Development
Geek Trivia
Software/Web Development
Web Development Zone, Visual Basic, .NET

advertisement
Click Here