scan your network with bash IP scan script
Here is the youtbe video that will walk you through bash script.
Here is the youtbe video that will walk you through bash script.
I generallly keep doing this a lot, so thought will share with you. Lets assume we are capturing free ouput every min/hour/or whatever. The output looks like this:
Time: Mon Jan 21 23:59:10 AEDT 2019
——————-total used free shared buff/cache available
Mem: 32014 8656 1735 1697 21621 21308
Swap: 51195 75 51120
then we can use some grep and sed to convert this to something like this:
Mon Jan 21 23:59:10 AEDT 2019,32014,8656,1735,1697,21621,21308
Continue reading
Some times I need random string, for example to use as email seperator or to use in some API. One way is to use tools like /dev/[u]random or od and other such. But they seem cubersome after I figured this out.
openssl rand <length> openssl rand 10
This alone without some parameters is not interesting thoug. You can use ‘-base64’ or ‘-hex’ to select the encoding.
So if you execute the above you will get something like this
Continue readingHere is the script:
#!/bin/bash - #=============================================================================== # # FILE: imgOrg.sh # # USAGE: ./imgOrg.sh # # DESCRIPTION: # # OPTIONS: --- # REQUIREMENTS: --- # BUGS: --- # NOTES: --- # AUTHOR: Amit Agarwal (aka) # REVISION: --- #=============================================================================== for i in * do if [[ $(file $i) == *image* ]] then echo "Image file is :: $i" dir=$( exiftool -s -DateTimeOriginal $i | awk -F':' '{print $2"/"$3}') mkdir -p $dir cp $i $dir/ else echo "Excluding $i" fi done
Continue reading
If you have tried to get the count of lines in file, the you would know about “nl” or “wc -l”. But as you are aware these give you number of lines with other details as well and you need to post process the number to make sure that you have only number and nothing else. In such cases, it is useful to use the count feature of grep and here is a shorthand to get the count of lines in any shell script:
Continue reading<a target="_blank" href="http://www.andreaplanet.com/andreamosaic/download/">
<a href="http://calypso.tux.org/pipermail/novalug/2009-February/017524.html">[Novalug] Filename handling: correctness vs. convenience has a nice post from Michael Henry on Filename handling.