Adel ALLAM @apges01

linux

Rofi menu

# select pid
$ ps -ef | rofi -dmenu | awk '{print $2}'
$ alias rkill='kill -9 $(ps a | rofi -dmenu | awk "{ print $1 }")'

Execute bash commands without spaces

$ {ping,-c,1,127.0.0.1}
$ ping${IFS}-c${IFS}1${IFS}127.0.0.1

Docker

# find docker image
$ sudo docker search ubuntu --limit 10

# pull image
$ sudo docker pull ubuntu:18.04 # will be placed in /var/lib/docker/

# get shell in the container
$ sudo docker run -it ubuntu:18.04

# execute command on running container
$ sudo docker exec awesome_hertz "id"

# get stdout
$ sudo docker logs awesome_hertz

Dockerfile

FROM ubuntu:18.04

RUN apt update && apt install -y socat

COPY ./start.sh /root
COPY ./script.sh /var/www/html

USER analyzer # create user
WORKDIR /home/analyzer # define pwd

CMD ["/bin/sh"]
FROM ubuntu:18.04

Specify the base image to use.

RUN apt update && apt install socat

Execute command in the container.

COPY ./script.sh /var/www/html

Copy file from outside.

CMD ["/bin/sh"] # or ENTRYPOINT ["/root/start.sh"]

The first action to do, command or script.

# delete image
$ docker image rm -f 3d58eb2db4a0 # img_id