Skip to content

Commit

Permalink
chore: various minor edits
Browse files Browse the repository at this point in the history
Various minor edits, primarily regarding whitespace and the use of
colons for consistency.
  • Loading branch information
chrisallenlane committed Nov 22, 2022
1 parent 4dd9b12 commit 5170ed5
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 37 deletions.
1 change: 0 additions & 1 deletion cpio
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ ls | cpio --create > <path/to/archive.cpio>

# Extract a specific cpio archive:
cpio --extract --make-directories < <path/to/archive.cpio>

33 changes: 16 additions & 17 deletions docker
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# To start the docker daemon:
docker -d

# To build a docker image
# To build a docker image:
docker build -t <image-tag-name> <path-of-Dockerfile>

# To start a container with an interactive shell:
docker run -ti <image-name> /bin/bash

# To run a docker container in the background
# To run a docker container in the background:
docker run -d <image-name>

# To "shell" into a running container (docker-1.3+):
Expand All @@ -31,7 +31,7 @@ docker ps
# To list all containers:
docker ps -a

# To remove all stopped containers
# To remove all stopped containers:
docker container prune

# To remove all stopped containers:
Expand All @@ -40,7 +40,7 @@ docker rm $(docker ps -qa)
# To list all images:
docker images

# To only see all images id
# To only see all images id:
docker image ls -q

# To remove all untagged images:
Expand All @@ -55,16 +55,16 @@ docker save -o <archive-name>.tar <image-name>
# To restore image from a saved tar archive:
docker load -i <archive-name>.tar

# To remove an image
# To remove an image:
docker image rm <image-name-or-id>

# To tag an image
# To tag an image:
docker image tag <image-name>:<tag-name> <image-name>:<new-tag-name>

# 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 <image-name>:<image-tag-name>

# List all networks daemon knows about:
Expand All @@ -79,27 +79,26 @@ docker network connect "<network_id|name>" "<container_id|name>"
# Disconnect a specific container from network:
docker network disconnect "<network_id|name>" "<container_id|name>"

# To see the logs of a background or stopped container
# To see the logs of a background or stopped container:
docker logs <container-id>

# To publish a port of container on localhost
# To publish a port of container on localhost:
docker run -p <localhost-port>:<container-port> <image-name>

# To create a docker volume
# To create a docker volume:
docker volume create <volume-name>

# To see information of a docker volume
# To see information of a docker volume:
docker volume inspect <volume-name>

# To use a volume in the container
# To use a volume in the container:
docker run -v <volume-name>:<folder-path-in-container> <image>

# To link current folder between host and container for development
# To link current folder between host and container for development:
docker run <image-name> -v $(pwd):<folder-path-in-container> <image>

# To copy a file from the running container to host mechine
# To copy a file from the running container to host mechine:
docker cp <container-id>:<path/to/file> <host/copy/path>

# To copy a file from host mechine to the running container
# To copy a file from host mechine to the running container:
docker cp <host/copy/path> <container-id>:<path/to/file>

2 changes: 1 addition & 1 deletion find
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,5 @@ find -L /usr/ports/packages -type l
# 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
# To find files that are newer than a file:
find <path> -newer <target-file>
3 changes: 1 addition & 2 deletions fmt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
# To format lines, 50 words in each line
# To format lines, 50 words in each line:
cat <file> | fmt -w 50

9 changes: 4 additions & 5 deletions jobs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# To see the background running commands
# To see the background running commands:
jobs

# To see the background running commands with PID
# To see the background running commands with PID:
jobs -l

# To see the running jobs only
# To see the running jobs only:
jobs -r

# To see stopped jobs only
# To see stopped jobs only:
jobs -s

5 changes: 2 additions & 3 deletions ls
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ls <dir>
# To display everything in <dir>, including hidden files:
ls -a <dir>

# 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 <dir>

# To display files, sorted by size:
Expand All @@ -29,6 +29,5 @@ ls -1
# see also `cheat chmod` for `/bin/chmod` options for ACLs
/bin/ls -le

# To show all the subtree files (Recursive Mode)
# To show all the subtree files (Recursive Mode):
ls -R

3 changes: 1 addition & 2 deletions man
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ man 7 ascii
# To see config:
cat /private/etc/man.conf

# To check the existence of a keyword in all of man pages
# To check the existence of a keyword in all of man pages:
man -k <keyword>

4 changes: 2 additions & 2 deletions tar
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +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
# To append a new file to an old tar archive:
tar -rf <archive.tar> <new-file-to-append>
6 changes: 2 additions & 4 deletions touch
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
# To change a file's modification time
# To change a file's modification time:
touch -d <time> <file>
touch -d 12am <file>
touch -d "yesterday 6am" <file>
touch -d "2 days ago 10:00" <file>
touch -d "tomorrow 04:00" <file>


# To put the timestamp of a file on another
# To put the timestamp of a file on another:
touch -r <refrence-file> <target-file>

0 comments on commit 5170ed5

Please sign in to comment.