Scripts & Programs
Please note that not every script and/or program was written by me and not every script (over several hundreds) written by me is posted here. Those that were written by me (with help from others) were done so to save myself some time and the trouble of manually doing the same thing over and over again. I have used (some of) these on RHEL, Fedora, Debian & Ubuntu distributions; and are posted here with no guarantee that they will work for you. sgowtham.net is not responsible for any/all damage caused, intellectual and/or otherwise.
| # | Type | Description |
| 001 | EXPECT |
remote-login.exp
When a server keeps prompting for password at SSH/SCP attempts in spite of setting up RSA/DSA keys, this script can be used to overcome that issue. Make sure that the script has 700 permission as it will contain your password in plain text. |
| 002 | BASH |
read-lines.sh
Reads one line at a time from a specified file. Can be of use to extract some information from those lines. |
| 003 | BASH |
file-size-sum.sh
Calculates the sum of all files in a directory (in bytes). |
| 004 | BASH |
space-remover.sh
Removes spaces in filenames (of all files in a directory) and replaces them with underscore. |
| 005 | BASH |
bracket-remover.sh
Removes paranthesis in filenames. |
| 006 | BASH |
find-string.sh
Search a given type of files for a string. |
| 007 | PERL |
perl-passwd.pl
Quickly generate a password (one could use mkpasswd as well). The password generated with this script has its first two characters as the 'salt' (pre-defined), easily indicating whether the user has changed the temporary password or not (by looking at the corresponding entry in /etc/shadow. |
| 008 | BASH |
file-info.sh
Displays information about a file (name, owner, size, inode, type, access rights, etc.). |
| 009 | BASH |
nsum.sh
Calculate the arithmetic sum of all integers between any two given integers. |
| 010 | BASH |
system-details.sh
Displays some useful system related information (MAC/IP Addresses, Kernel version, etc.) along with current user's HOME folder, disk usage, login shell and such. |
| 011 | BASH |
whereami.sh
For a given list of hosts, this will display if the user has logged in those hosts or not. |
| 012 | PERL |
blog-remind.pl
Having quite many friends who have blogs (some of whom do not find enough free time to write sometimes), this PERL script makes it easier to remind them to write it. Works best as a cron job and needs a properly working version of some sort of a blog aggregator (Planet). |
| 013 | BASH |
toggle-case.sh
This script will convert upper (lower) case filenames to lower (upper) case. Affects all files in a given directory, including any directory. |
| 014 | BASH |
align-center.sh
Center aligns the text (79 column max width) |
| 015 | PERL |
disk-usage.pl
Checks disk usage and sends emails to users hogging more than a specified limit. |
| 016 | PERL |
title-network.pl
Paul Schou wrote this script which extracts & displays some useful information [Hostname, SSID, IP Address(es)...] in the title bar of a terminal. It may require some modification if your login shell is not bash and/or if your linux distribution is something other than Red Hat / Fedora Core. Make sure to add the following line to ~/.bash_logout : |
| 017 | BASH |
router-ip.sh
Displays the IP address assigned by the router to the machine as well the router's public IP address (from the ISP). Quite a few bugs were fixed and some other parts were cleaned up by Jon 'Security Hole' DeVree |
| 018 | C |
shift-xyz.c
Reads a set of XYZ co-ordinates and shifts each of them by a certain pre-defined amount - especially useful if the system-under-consideration needs to be translated along a particular axis (or axes). |
| 019 | PERL |
apache-logrotate.pl
Rotates & compresses Apache Server Logs automatically. Read the script for a detailed description (Thanks to David Torrey for fixing a bug). |
| 020 | PERL |
title-load.pl
Displays the system load average in the title bar of a terminal. It may require some modification if your login shell is not bash. Make sure to add the following line to ~/.bash_logout : |
| 021 | BASH |
login-counter.sh
Displays the number of login attempts by users on a given machine. |
| 022 | BASH |
renumber.sh
Renumbers all the JPEG files in a directory as picture-1.jpg, picture-2.jpg, and so on. You can edit this script (file name extension) to rename any other type of file too. |
| 023 | BASH |
eps2jpg.sh
Converts all EPS files in a directory to JPEG. More such scripts can be written (to inter-convert image files between different formats) by using the convert utility. |
| 024 | C |
center-of-mass.c
Calculates the center of mass for a given system of particles and distace to each particle from the calculated center of mass. Particles can be anywhere in space and all of them need not have the same mass. |
| 025 | BASH |
resize.sh
Resizes all JPEG files in a directory to pre-defined size and places them in a sub-directory called resized. Make sure that the original images are backed up and, are larger than the pre-defined size - otherwise, final image is more likely to be distorted. Comes pretty handy while creating images for web, thumbnails, etc. |