From 1cc527954b99d1a5dce4d7ed65e802f2d680fd54 Mon Sep 17 00:00:00 2001 From: Brendan McDevitt Date: Fri, 18 Nov 2016 06:50:09 -0600 Subject: [PATCH 1/3] updated .env to include term colors to comment out for root or normal user --- .env | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.env b/.env index e3b90b1..783d8b0 100644 --- a/.env +++ b/.env @@ -1,6 +1,13 @@ # Enviroment Variables export PATH=$PATH:$HOME/bin -export PS1="\[\e[32m\]\u\[\e[m\]@\H\[\e[36m\][\[\e[m\]\[\e[33m\]\w\[\e[m\]\[\e[36m\]]\[\e[m\]: " + +# Terminal color + +# green@white[abspath] +#export PS1="\[\e[32m\]\u\[\e[m\]@\H\[\e[36m\][\[\e[m\]\[\e[33m\]\w\[\e[m\]\[\e[36m\]]\[\e[m\]: " +# red@white[abspath] +export PS1="\[\e[31m\]\u\[\e[m\]@\H\[\e[36m\][\[\e[m\]\[\e[33m\]\w\[\e[m\]\[\e[36m\]]\[\e[m\]: " + export EDITOR=vim export HISTTIMEFORMAT="%d/%m/%y %T " From 3d1a465c556644e67265b713081c0d33299c2605 Mon Sep 17 00:00:00 2001 From: Brendan McDevitt Date: Mon, 30 Jan 2017 22:30:01 -0600 Subject: [PATCH 2/3] added cve_lookup function to .bash_functions --- .bash_functions | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.bash_functions b/.bash_functions index d6ba398..6145221 100644 --- a/.bash_functions +++ b/.bash_functions @@ -162,3 +162,13 @@ on() fi } + +cve_lookup() + +{ + [[ -z "$1" ]] && echo "Usage: $0 CVE-YYYY-NNNN" + + curl -s http://www.cvedetails.com/cve/$1/ | grep 'meta name="description" content="' | awk -F\" '{print $4}' + +} + From cc60c3a64502a44fd78aecccb036c900245a7e34 Mon Sep 17 00:00:00 2001 From: Brendan McDevitt Date: Tue, 31 Jan 2017 00:52:06 -0600 Subject: [PATCH 3/3] added function swap_used() to .bash_functions --- .bash_functions | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/.bash_functions b/.bash_functions index 6145221..5ef6df5 100644 --- a/.bash_functions +++ b/.bash_functions @@ -172,3 +172,27 @@ cve_lookup() } + +swap_used() + +{ + + SUM=0 + OVERALL=0 + for DIR in `find /proc/ -maxdepth 1 -type d -regex "^/proc/[0-9]+"` + do + PID=`echo $DIR | cut -d / -f 3` + PROGNAME=`ps -p $PID -o comm --no-headers` + for SWAP in `grep Swap $DIR/smaps 2>/dev/null | awk '{ print $2 }'` + do + let SUM=$SUM+$SWAP + done + if (( $SUM > 0 )); then + echo "PID=$PID swapped $SUM KB ($PROGNAME)" + fi + let OVERALL=$OVERALL+$SUM + SUM=0 + done + echo "Overall swap used: $OVERALL KB" + +}