Friday, 7 July 2017

How can I shut down or reboot Ubuntu using terminal commands?

For Shutdown:
$sudo poweroff
(or)
$sudo shutdown -h now
(or)
$sudo halt
(or)
$sudo init 0
For Restart:
$sudo reboot
(or)
$sudo shutdown -r now
(or)
$sudo init 6

For Ubuntu 15.04 and later:
systemctl poweroff
systemctl reboot
systemctl suspend
systemctl hibernate
systemctl hybrid-sleep

Ubuntu 16.04 no need of say sudo also
To shutdown :
poweroff
To Reboot :
reboot

Install docker on Ubuntu 16.04 using command line interface (CLI)

Prerequisites
  • 64-bit Ubuntu 16.04 server
  • Ubuntu 16.04 Operating System
  • Step1 Installing Docker First, add the GPG key for the official Docker repository to the system: $curl -fsSL https://download.docker.com/linux/ubuntu/gpg |sudo apt-key add - Add the Docker repository to APT sources: $sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" update the package database with the Docker packages from the newly added repo: $sudo apt-get update Make sure you are about to install from the Docker repo instead of the default Ubuntu 16.04 repo: $apt-cache policy docker-ce Check that its Running: $sudo systemctl status docker Step2 Executing the Docker Command Without Sudo $sudo usermod -aG docker ${USER} $sudo usermod -aG docker username restart the machine $sudo shutdown -r now verify the docker commands are running without sudo: $docker info step3 Working with Docker Images $docker search ubuntu $docker pull ubuntu $docker run ubuntu $docker images step4 Running a Docker Container $docker run -it ubuntu root@d9b100f2f636:/# step5 Pushing Docker Images to a Docker Repository $docker login -u docker-registry-username $docker push docker-registry-username/docker-image-name