In today’s column, we’re going to look at a script that turns sar data into useful little performance graphs using sag, the system activity grapher. The sag utility reads data from sar’s binary files and, provided with a graphical terminal, creates a line chart showing CPU usage or some other sar data.To use this script, graciously provided by Andrew Hay (“Sandwich Maker” to me), I started an X client on my laptop, logged in to one of my servers and invoked the script. A few seconds later, a graph of today’s CPU usage opened on my screen.Both sar and sag go a lot further back than I had suspected. While I began using sar in some release of SunOS 2.x, the commands may date back as far as AT&T System V. #!/usr/bin/ksh -p # xsag - graph sar data on screen # 20041001 adh@an.bradford.ma.us [ -n "$1" ] && { typeset -Z2 DAY=$(($(date +%d) - $1)) (( DAY `tty` stty 0:1805:f003f:0:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff; exec nice -19 sh -n" Cut and paste the script into a file and make it executable. Much of the text in the xterm line is there to null out the tty and shell control characters while the final sh holds the xterm open after sag has completed its work so that you have a chance to look at the graph. I also had to make sure that biff (/usr/ucb/biff) was on my search path.Thanks to Sandwich Maker for sharing his script. Related content how-to How to find files on Linux There are many options you can use to find files on Linux, including searching by file name (or partial name), age, owner, group, size, type and inode number. By Sandra Henry Stocker Jun 24, 2024 8 mins Linux opinion Linux in your car: Red Hat’s milestone collaboration with exida With contributions from Red Hat and critical collaborators, the safety and security of automotive vehicles has reached a new level of reliability. By Sandra Henry Stocker Jun 17, 2024 5 mins Linux how-to How to print from the Linux command line: double-sided, landscape and more There's a lot more to printing from the Linux command line than the lp command. Check out some of the many available options. By Sandra Henry Stocker Jun 11, 2024 6 mins Linux how-to Converting between uppercase and lowercase on the Linux command line Converting text between uppercase and lowercase can be very tedious, especially when you want to avoid inadvertent misspellings. Fortunately, Linux provides a handful of commands that can make the job very easy. By Sandra Henry Stocker Jun 07, 2024 5 mins Linux PODCASTS VIDEOS RESOURCES EVENTS NEWSLETTERS Newsletter Promo Module Test Description for newsletter promo module. Please enter a valid email address Subscribe