darekf77
4/14/2017 - 8:51 AM

usefull commands bash

usefull commands bash


# find public ip
ip addr show eth0 | grep inet | awk ‘{ print $2; }’ | sed ’s/\/.*$//‘

# current branch name 
git branch | grep -e "^*" | cut -d' ' -f 2

#get user UID
id -u darek

# set ownership
setfacl -m u:darek:rwx /home/darek/

# add to sudders 
usermod -aG sudo darek 

#calculate command time in s
START=$(date +%s)
echo $START
sleep 2
END=$(date +%s)
echo $END
DIFF=$(echo "$END - $START" | bc)
echo "deploy done in $DIFF seconds"
sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"