diff --git a/cpio b/cpio new file mode 100644 index 0000000..f00721f --- /dev/null +++ b/cpio @@ -0,0 +1,5 @@ +# Create a specific cpio archive: +ls | cpio --create > + +# Extract a specific cpio archive: +cpio --extract --make-directories < diff --git a/docker b/docker index e252582..178262f 100644 --- a/docker +++ b/docker @@ -7,6 +7,9 @@ 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,7 +55,7 @@ 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: @@ -69,3 +78,27 @@ docker network connect "" "" # Disconnect a specific container from network: docker network disconnect "" "" + +# 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 : diff --git a/find b/find index 89259d3..a02b1aa 100644 --- a/find +++ b/find @@ -78,3 +78,6 @@ find -L /usr/ports/packages -type l # To find and run multiple shell commands (without multiple execs): # See: https://stackoverflow.com/questions/5119946/find-exec-with-multiple-commands find . -type f -exec sh -c "echo '{}'; cat '{}';" \; + +# To find files that are newer than a file: +find -newer diff --git a/fmt b/fmt new file mode 100644 index 0000000..322ec7c --- /dev/null +++ b/fmt @@ -0,0 +1,2 @@ +# To format lines, 50 words in each line: +cat | fmt -w 50 diff --git a/jobs b/jobs new file mode 100644 index 0000000..a464f20 --- /dev/null +++ b/jobs @@ -0,0 +1,11 @@ +# To see the background running commands: +jobs + +# To see the background running commands with PID: +jobs -l + +# To see the running jobs only: +jobs -r + +# To see stopped jobs only: +jobs -s diff --git a/ls b/ls index b10d89c..a19fe44 100644 --- a/ls +++ b/ls @@ -4,7 +4,7 @@ ls # To display everything in , including hidden files: ls -a -# To display all files, along with the size (with unit suffixes) and timestamp +# To display all files, along with the size (with unit suffixes) and timestamp: ls -lh # To display files, sorted by size: @@ -28,3 +28,6 @@ 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 diff --git a/man b/man index 1c86ad1..6d231c8 100644 --- a/man +++ b/man @@ -6,3 +6,6 @@ man 7 ascii # To see config: cat /private/etc/man.conf + +# To check the existence of a keyword in all of man pages: +man -k diff --git a/tar b/tar index 10937da..66b8633 100644 --- a/tar +++ b/tar @@ -31,10 +31,13 @@ tar -cjvf /path/to/foo.tar.bz2 /path/to/foo/ # To list the content of an .tar.bz2 archive: tar -tjvf /path/to/foo.tar.bz2 -# To create a .tgz archive and exclude all jpg,gif,... from the tgz +# To create a .tgz archive and exclude all jpg,gif,... from the tgz: tar -czvf /path/to/foo.tgz --exclude=\*.{jpg,gif,png,wmv,flv,tar.gz,zip} /path/to/foo/ # To use parallel (multi-threaded) implementation of compression algorithms: tar -z ... -> tar -Ipigz ... tar -j ... -> tar -Ipbzip2 ... tar -J ... -> tar -Ipixz ... + +# To append a new file to an old tar archive: +tar -rf diff --git a/touch b/touch new file mode 100644 index 0000000..05a33b8 --- /dev/null +++ b/touch @@ -0,0 +1,9 @@ +# To change a file's modification time: +touch -d