Skip to main content

CentOS commands

CentOS commands:

1) To view the list of packages installed

> yum list installed

2) To view the count of packages installed

> yum list installed | wc -l

3) To refresh package database and install updates if any

> yum update -y 

(-y is added so that you need not respond with y or yes when prompted)

4) To check if package is installed

> rpm -qa | grep <package-name>

e.g., rpm -qa | grep docker

5) To install docker

> yum install -y https://download.docker.com/linux/centos/8/x86_64/stable/Packages/containerd.io-1.4.3-3.1.el8.x86_64.rpm

> curl -fsSL https://get.docker.com/ | sh

> rpm -qa | grep docker

docker-ce-20.10.3-3.el8.x86_64
docker-ce-rootless-extras-20.10.3-3.el8.x86_64
docker-ce-cli-20.10.3-3.el8.x86_64

COURTESY: https://vexpose.blog/2020/04/02/installation-of-docker-fails-on-centos-8-with-error-package-containerd-io-1-2-10-3-2-el7-x86-64-is-excluded/

6) To start, stop and view status of docker

> systemctl start docker
> systemctl enable docker
> systemctl status docker

7) To list all containers

> docker container ls

8) To list both running and stopped containers

> docker ps -a

9) To list only stopped containers

> docker ps -a | grep Exit

10) To lists all images

> docker images -a OR docker image ls

11) To remove a container by container-id

> docker rm <first-few-chars-of-container-id>

12) Docker provides a single command that will clean up any resources — images, containers, volumes, and networks — that are dangling (not associated with a container)

> docker system prune

13) To remove a container by image-id

> docker rmi <first-few-chars-of-image-id>

14) To install a container

> docker pull docker/whalesay

15) To run container

e.g., > docker run docker/whalesay cowsay Hi

This will start the container from the image if the image is already present. If the image is not present already, it will download the image and start the container

16) To get ip address

> ifconfig

ens33: ...
inet <YOUR-IP-HERE>  netmask X.X.X.X  broadcast Y.Y.Y.Y

17) Find commands

> find . -type f -name filename

To find files with name filename in the current directory

> find / -type d -name directoryname

To find directories with name directoryname in the entire disk

Comments

Popular posts from this blog

How to install/upgrade/downgrade kubectl in Linux (Ubuntu)?

To install the latest version: curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" curl -LO "https://dl.k8s.io/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl.sha256" echo "$(<kubectl.sha256) kubectl" | sha256sum --check sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl kubectl version --client kubectl version To install a specific (v1.19.0) version: curl -LO "https://dl.k8s.io/release/v1.19.0/bin/linux/amd64/kubectl" curl -LO "https://dl.k8s.io/v1.19.0/bin/linux/amd64/kubectl.sha256" echo "$(<kubectl.sha256) kubectl" | sha256sum --check sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl kubectl version --client kubectl version This will install kubectl client. Run minikube start to install kubectl server.

Application Load Balancer (ALB)

The ALB spans all subnets in a VPC i.e., it is not inside a subnet but VPC. ALB is bound to Target Groups (TGs). TGs are bound to subnets.