Skip to content

bash functions

robertstrom edited this page Aug 17, 2021 · 13 revisions

function grepEmailAddresses() { grep -E -o "\b[a-zA-Z0-9.-]+@[a-zA-Z0-9.-](+.|.)[a-zA-Z0-9.-]+\b" $1 }

function grepURLs() { grep -oE '\b(https?|ftp|file)://[-A-Za-z0-9+&@#/%?=~_|!:,.;]*[-A-Za-z0-9+&@#/%=~_|]' }

function convertFromHexGetURLs() { sed "s/<script language.*('//g" $1 | sed "s/').*$//g" | xxd -r -p | grep -oE '\b(https?|ftp|file)://[-A-Za-z0-9$ }

function convertFromHexGetEmail() { sed "s/<script language.*('//g" $1 | sed "s/').*$//g" | xxd -r -p | sed "s/&#46;/./g" | grep -E -o "\b[a-zA-Z0-$ }

get-geoipinfo-io() { #do things with parameters like $1 such as curl ipinfo.io/"$1" }

get-geoiplookup-io() { #do things with parameters like $1 such as curl https://json.geoiplookup.io/geo/"$1" }

get-LinuxInstallDate() { echo "" echo "The lost+found install date is:" ls -ld /lost+found echo "" echo "The /var/log/installer install date is:" ls -ld /var/log/installer echo "" }

mount-d-drive() { sudo mount -t drvfs d: /mnt/d cd /mnt/d }

mount-e-drive() { sudo mount -t drvfs e: /mnt/e cd /mnt/e }

unmount-d-drive() { cd ~ sudo umount /mnt/d }

unmount-e-drive() { cd ~ sudo umount /mnt/e }

Clone this wiki locally