Get the lines number of a directory
find . -name "*.js" -type f -exec cat {} \; | wc -l
Get the size number of a directory
find . -name "*.js" -type f -exec cat {} \; | wc -c
Get current connections info
ss --options --extended --memory --processes --info
Show TLS Certificate info
openssl s_client -state -connect google.com:443
Connect via HTTPS:
openssl s_client -state -CAfile startssl.ca.crt -connect igvita.com:443
ldd binary-path
sudo curl -sSL https://get.docker.com/ | sh && sudo gpasswd -a ${USER} docker
To change terminal title add the following function to .bashrc
:
st(){
echo -en "\033]0;$1\a"
}
To set the colored promt with current branch name add the following to .bashrc
:
parse_git_branch() {
local branch=$(git branch 2> /dev/null | \
sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/')
if [[ $branch ]]; then
local -i MAX_LENGTH=30
local -i branch_characters=${#branch}
if ((branch_characters > MAX_LENGTH)) ; then
branch="${branch::30}...)"
fi
echo "$branch"
fi
}
GREEN="\[\033[0;32m\]"
NO_COLOR="\[\033[0m\]"
PS1="$GREEN\$(parse_git_branch)$NO_COLOR${debian_chroot:+($debian_chroot)}\w$ "