Windows Cheatsheet for Linux Engineers

Most dev-op engineers are either Windows or Linux expert but not both. This article provides you with resources on commonly used command and documentations.

Please note that this article shows close command equivalent only; the commands do not necessarily give you the exact same kind of data.

Frequently Used Commands

Shell on Linux Powershell on Windows
cat cat
cd cd
date date or Get-Date
df -hi Get-PSDrive
env Get-ChildItem Env:
... | grep ... | findstr
history history
ifconfig ipconfig
ls ls or Get-Children
nslookup nslookup or Resolve-DnsName
netstat netstat
ping ping
ps ps or Get-Process
ssh Enter-PSSession
systemctl start docker Start-Service docker
systemctl stop docker Stop-Service docker
... | tail -n 5 ... | Select-Object -Last 5
top While(1) {ps | sort -des cpu | select -f 15 | ft -a; sleep 2; cls}
tree tree
vivimgedit notepad

Important Directories (defaults)

Linux Windows
client binary /usr/bin/docker C:\Program Files\Docker\docker.exe
daemon binary /usr/bin/dockerd C:\Program Files\Docker\dockerd.exe
daemon config /etc/docker C:\ProgramData\docker\config
data root dir /var/lib/docker C:\ProgramData\docker
host file /etc/hosts C:\Windows\System32\drivers\etc\hosts

AWS EC2 – Automatic AMI

I have a AWS EC2 instance That i need to manually access to the AWS console and make a daily image of the machine(AMI)

How i can make a daily AMI backup of the machine and delete old version (old then 7 days)?

Thank you!

Solution:

Anything that you can do through the web console you can also do through the CLI.

In this particular case, I suspect a combination of aws ec2 create-image, aws ec2 describe-images, and aws ec2 deregister-image would let you do what you want.

centos7 container is restarting continuously

I am trying to run centos7 container using following Docker compose file and Dockerfile-

version: "2"    data:
    build:
      context: ./docker-build
      dockerfile: Dockerfile.data
    restart: always
    ports:
      - "8082:8082"
    command: bash

Dockerfile:

FROM centos:7
RUN yum -y update
CMD /bin/sh 

The container is restarting continuously I don’t know the reason for it, How can I resolve this?

Solution:

Containers stop once their main process exits. In your case, the main process is a shell (/bin/sh or bash). A shell without a TTY attached exits immediately.

If you want to keep your container running, add a TTY to the container;

When using docker run;

Run a container interactively;

docker run -it centos:7 bash

Run the container in the background (“detached”, -d);

docker run -dit centos:7 bash

When using a docker-compose.yml:

version: "2"
services:
  data:
    build:
      context: ./docker-build
      dockerfile: Dockerfile.data
    restart: always
    ports:
      - "8082:8082"
    command: bash
    tty: true

Which is better Jenkins or Docker?

What are Jenkins and Docker in terms of Devops? Are they different tools? which one is better? I am a QA and my primary area is manual testing, but I am learning Selenium webdriver with Java for Automation. I want to learn Devops for better career, which one to chose between Jenkins and Docker?

Solution:

They are different. While docker helps you run your final image inside containers (which includes all you need for your piece of software to run), Jenkins handles the CI / CD bit.

You have some code, that is in python and have some dependencies. Make a package of this using docker and run it inside a container. This can be done in docker. How and where the container is run is something that Jenkins helps in.

You may want to change your question to Jenkins vs Shippable. In which case, I recommend Shippable. It gives you better options for CI / CD and much easier to setup the pipeline.

You are heading in the right direction by learning DevOps. Good luck!