From 6ba82ce5cce762ae1079fcf9783342c584802544 Mon Sep 17 00:00:00 2001 From: ThirdScript Date: Sat, 17 Sep 2022 15:09:46 +0430 Subject: [PATCH 01/33] Create cpio command cheatsheet --- cpio | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 cpio diff --git a/cpio b/cpio new file mode 100644 index 0000000..0e0e62f --- /dev/null +++ b/cpio @@ -0,0 +1,6 @@ +# To create a cpio archive +ls | cpio -o > + +# To extract a cpio archive +cpio -id < + From f98a5cb5acce1a7d1206fcf0f01edd0a176bc1d9 Mon Sep 17 00:00:00 2001 From: ThirdScript Date: Sat, 17 Sep 2022 15:10:14 +0430 Subject: [PATCH 02/33] Update docker: port publishing, containers, volumes, file copy --- docker | 44 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 39 insertions(+), 5 deletions(-) diff --git a/docker b/docker index dcf831f..893ecdd 100644 --- a/docker +++ b/docker @@ -1,12 +1,15 @@ # To start the docker daemon: docker -d -# To build a docker image: +# To build a docker image docker build -t # To start a container with an interactive shell: docker run -ti /bin/bash +# To run a docker container in the background +docker run -d + # To "shell" into a running container (docker-1.3+): docker exec -ti bash @@ -28,12 +31,18 @@ docker ps # To list all containers: docker ps -a +# To remove all stopped containers +docker container prune + # To remove all stopped containers: docker rm $(docker ps -qa) # To list all images: docker images +# To only see all images id +docker image ls -q + # To remove all untagged images: docker rmi $(docker images | grep "^" | awk '{print $3}') @@ -46,14 +55,39 @@ docker save -o .tar # To restore image from a saved tar archive: docker load -i .tar -# To remove an image image: +# To remove an image docker image rm -# To tag an image: +# To tag an image docker image tag : : -# To login into hub.docker.com: +# To login into hub.docker.com docker login -# To push a docker image into dockerhub repository: +# To push a docker image into dockerhub repository docker push : + +# To see the logs of a background or stopped container +docker logs + +# To publish a port of container on localhost +docker run -p : + +# To create a docker volume +docker volume create + +# To see information of a docker volume +docker volume inspect + +# To use a volume in the container +docker run -v : + +# To link current folder between host and container for development +docker run -v $(pwd): + +# To copy a file from the running container to host mechine +docker cp : + +# To copy a file from host mechine to the running container +docker cp : + From e94db4f8f1a1fded0dcd17c60d17d2e693fc4ac6 Mon Sep 17 00:00:00 2001 From: ThirdScript Date: Sat, 17 Sep 2022 15:10:51 +0430 Subject: [PATCH 03/33] Add -r option to ls command --- ls | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ls b/ls index b10d89c..da3180f 100644 --- a/ls +++ b/ls @@ -28,3 +28,7 @@ ls -1 # To show ACLs (MacOS): # see also `cheat chmod` for `/bin/chmod` options for ACLs /bin/ls -le + +# To show all the subtree files (Recursive Mode) +ls -R + From d22dec687fcd835db60a04a1cde4e3339a691e78 Mon Sep 17 00:00:00 2001 From: ThirdScript Date: Sat, 17 Sep 2022 15:12:12 +0430 Subject: [PATCH 04/33] Add append option to tar command --- tar | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tar b/tar index 10937da..0fca5ff 100644 --- a/tar +++ b/tar @@ -38,3 +38,6 @@ tar -czvf /path/to/foo.tgz --exclude=\*.{jpg,gif,png,wmv,flv,tar.gz,zip} /path/t tar -z ... -> tar -Ipigz ... tar -j ... -> tar -Ipbzip2 ... tar -J ... -> tar -Ipixz ... + +# To append a new file to an old tar archive +tar -rf From f04cf2389740c380b12ded2ff87196fae3e3d1a6 Mon Sep 17 00:00:00 2001 From: ThirdScript Date: Sat, 17 Sep 2022 15:13:16 +0430 Subject: [PATCH 05/33] Create touch command cheatsheet --- touch | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 touch diff --git a/touch b/touch new file mode 100644 index 0000000..684c569 --- /dev/null +++ b/touch @@ -0,0 +1,11 @@ +# To change a file's modification time +touch -d