search for a port number

2017-09-11 1 min read bash Linux
I find myself doing google everytime I want to search for port number mapping. So, here is a short script to do just that 🙂 #!/bin/bash - #=============================================================================== # # FILE: portfind.sh # # USAGE: ./portfind.sh # # DESCRIPTION: # # OPTIONS: --- # REQUIREMENTS: --- # BUGS: --- # NOTES: --- # AUTHOR: Amit Agarwal (aka), # ORGANIZATION: # CREATED: 08/29/2017 19:00 # Last modified: Tue Aug 29, 2017 07:00PM # REVISION: --- #=============================================================================== set -o nounset # Treat unset variables as an error #This is the directory where you have mappings file downloaded ODIR=/root ofile=$ODIR/service-names-port-numbers. Continue reading

Check all vim colorschemes for minor issues

2013-10-10 2 min read bash Vim Tips
Here is script that checks all the colorschemes in the current directory and corrects them if possible (Processing of the file is done with simple commands like sed, grep) Checks that the color_name is same as Filename Here is the script: #!/bin/bash - #=============================================================================== # # FILE: check_colors.sh # # USAGE: ./check_colors.sh # # DESCRIPTION: # # OPTIONS: --- # REQUIREMENTS: --- # BUGS: --- # NOTES: --- # AUTHOR: Amit Agarwal (aka), # REVISION: --- #=============================================================================== cd ~/. Continue reading

Home grown mail scheduler with bash script and cron

2013-10-04 2 min read bash Linux
If you are using Linux (Fedora/Ubuntu or anything else) then you do get a lot of tools and one of them is cron. Very very useful. Just write some script that can do the task for you, put it in cron and forget it. So, here is a home grown way to schedule mails. First, copy this script below: #!/bin/bash - #=============================================================================== # # FILE: sched_mail.sh # # USAGE: ./sched_mail.sh # # DESCRIPTION: # # OPTIONS: --- # REQUIREMENTS: --- # BUGS: --- # NOTES: --- # AUTHOR: Amit Agarwal (aka), # REVISION: --- #=============================================================================== mailfile=" Continue reading

Delete all but some directories

2013-08-16 1 min read bash Fedora Linux
I think, like me, you would have faced a lot of situations, where you wanted to delete all the files or directories in a location, leaving only the required files/directories. So, I have a directory containing lots of files/directories and I want to delete most of them except some 5/10 of them, how to I do it. I finally wrote a small script to do that. First save list of files that you do not want to delete in file called “listnames” and then execute the below script. Continue reading

Manage your servers the easy way with perl script over ssh with no remote client.

2013-05-06 8 min read Linux perl
For a long time I have not posted any script. So, its not that I have not written anything new, but just that did not put them here in lack of time. So, here is one interesting one. The original idea came from one posted in one of the interesting blog here. But the problem with this one was that for every time, it ran in the cron, it would make multiple entries in the “last” output (about 10 or more with my modifications for differentiating between solaris and Linux). Continue reading

Disable a few cores when you want to save power.

2012-12-28 2 min read bash Fedora Linux
If you have a lot of CPU power and working on battery. If you do not need that much of power and would like to rather save some battery power by disabling some cpus then you can use the below script. This script disables cpus from 4 to 7. You can change the number in the for loop. You would need the sudo to be setup or remove sudo and run the script as root. Continue reading

quick bash script for datewise backup of directory

2012-12-12 1 min read bash Linux
I was working on something and the data was very critical and needed backup. I wrote a bash script to back up the data every 5 hours with cron and bash script. Thought I will share that with you. Here is the script. #!/bin/bash - #=============================================================================== # # FILE: backup.sh # # USAGE: ./backup.sh # # DESCRIPTION: Backup all the current files. # # OPTIONS: --- # REQUIREMENTS: --- # BUGS: --- # NOTES: --- # AUTHOR: Amit Agarwal (aka), amit. Continue reading
Older posts