For tab completion, install two packages called bash-completion & bash-completion-extras
RedHat/CentOS: sudo yum install bash-completion bash-completion-extras
Ubuntu/Debian: sudo apt install bash-completion bash-completion-extras
Friday, February 23, 2018
Tuesday, February 6, 2018
To find the time response of a website using curl
To find a website response time and other statistics, use curl command in linux with following options:
curl -s -w '\n Statistics for :%{url_effective}\n Remote IP:\t\t%{remote_ip}\n Name Lookup Time:\t%{time_namelookup}\n TCP Connect Time:\t%{time_connect}\n SSL Connect Time:\t%{time_appconnect}\n Redirect Time:\t\t%{time_redirect}\n Pre-transfer Time:\t%{time_pretransfer}\n Start-transfer Time:\t%{time_starttransfer}\n Total Time:\t\t%{time_total}\n HTTP Code:\t\t%{http_code}\n' -o /dev/null https://www.amazon.com
Statistics for : https://www.amazon.com/
Remote IP: 54.192.139.249
Name Lookup Time: 0.253042
TCP Connect Time: 0.326341
SSL Connect Time: 0.498637
Redirect Time: 0.000000
Pre-transfer Time: 0.498744
Start-transfer Time: 0.718770
Total Time: 1.270710
curl -s -w '\n Statistics for :%{url_effective}\n Remote IP:\t\t%{remote_ip}\n Name Lookup Time:\t%{time_namelookup}\n TCP Connect Time:\t%{time_connect}\n SSL Connect Time:\t%{time_appconnect}\n Redirect Time:\t\t%{time_redirect}\n Pre-transfer Time:\t%{time_pretransfer}\n Start-transfer Time:\t%{time_starttransfer}\n Total Time:\t\t%{time_total}\n HTTP Code:\t\t%{http_code}\n' -o /dev/null https://www.amazon.com
Statistics for : https://www.amazon.com/
Remote IP: 54.192.139.249
Name Lookup Time: 0.253042
TCP Connect Time: 0.326341
SSL Connect Time: 0.498637
Redirect Time: 0.000000
Pre-transfer Time: 0.498744
Start-transfer Time: 0.718770
Total Time: 1.270710
Sunday, February 4, 2018
Docker commands
#Build: To build, create a Dockerfile in a directory and inside the directory run the following command: (Change NAME with your image name)
docker build -t NAME .
#List Docker Images:
docker images
#Remove Docker Image
docker image rm -f ID
#Run: To run the container image called NAME with following options:
1. Map the host port 80 with container port 80
2. Limit memory to 1000MB
3. Limit CPU = 1
4. Assign name = NAME
--use the following command:
docker run --rm -it -p 80:80 -m 1000m --cpus=1 --name=NAME NAME
#List Docker processes
docker ps
#See a live stream of container(s) resource usage statistics (like top)
docker container stats
#Display the running processes of a container (one shot)
docker container top NAME
#Check iptables for port mapping:
sudo iptables -t nat -L -n
#Commit Container or take a snapshot while running:
docker commit NAME NAME:run
docker build -t NAME .
#List Docker Images:
docker images
#Remove Docker Image
docker image rm -f ID
#Run: To run the container image called NAME with following options:
1. Map the host port 80 with container port 80
2. Limit memory to 1000MB
3. Limit CPU = 1
4. Assign name = NAME
--use the following command:
docker run --rm -it -p 80:80 -m 1000m --cpus=1 --name=NAME NAME
#List Docker processes
docker ps
#See a live stream of container(s) resource usage statistics (like top)
docker container stats
#Display the running processes of a container (one shot)
docker container top NAME
sudo iptables -t nat -L -n
#Commit Container or take a snapshot while running:
docker commit NAME NAME:run
Dockerfile
#Create a Dockerfile in the project directory. Following is a sample Dockerfile to install ubuntu with postgres and apache
FROM ubuntu:rolling
FROM ubuntu:rolling
RUN apt update
RUN apt install -y vim python3-pip apache2 libapache2-mod-wsgi-py3 postgresql postgresql-contrib postgresql-server-dev-9.6 openssh-server sudo curl iproute
RUN pip3 install --upgrade pip
RUN pip3 install Django django-mathfilters lxml psycopg2-binary requests
ADD install.sh /
ENTRYPOINT ["/bin/bash", "-x", "install.sh", "arg1"]
RUN apt install -y vim python3-pip apache2 libapache2-mod-wsgi-py3 postgresql postgresql-contrib postgresql-server-dev-9.6 openssh-server sudo curl iproute
RUN pip3 install --upgrade pip
RUN pip3 install Django django-mathfilters lxml psycopg2-binary requests
ADD install.sh /
ENTRYPOINT ["/bin/bash", "-x", "install.sh", "arg1"]
Subscribe to:
Posts (Atom)