Devops Tools Cheat Sheet - Merged
Devops Tools Cheat Sheet - Merged
© Nic Wortel, Software Consultant & Trainer - Last update: August 3, 2023 - Find more cheat sheets at https://nicwortel.nl/cheat-sheets
AWS Cheat Sheet
Installation Identity and Access Management (IAM)
Command Description
See https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html
aws iam list-users List users
For autocompletion see https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-completion.html.
aws iam list-groups List groups
aws iam list-roles List roles
Global flags
aws iam list-policies List policies
Flag Description
aws iam create-user --user-name <name> Create a user
--profile <name> Run a command using the specified profile
aws iam create-group --group-name
--output <style> Format output as (json/text/table/yaml) Create a group
<name>
--help Show help
aws iam create-role --role-name <name>
Create a role
--endpoint-url <url> Override default API endpoint --assume-role-policy-document <policy>
Command Description
aws configure --profile <name> Create a new profile Elastic Kubernetes Service (EKS)
aws configure list-profiles Show available profiles Command Description
aws eks list-clusters List clusters
Account information aws eks describe-cluster --name <name> Describe a cluster
Command Description aws eks create-cluster --name <name> Create a cluster
aws sts get-caller-identity Retrieve account information aws eks delete-cluster --name <name> Delete a cluster
© Nic Wortel, Software Consultant & Trainer - Last update: February 17, 2024 - Find more cheat sheets at https://nicwortel.nl/cheat-sheets
Relational Database Service (RDS)
Command Description
aws rds describe-db-clusters List clusters
aws rds describe-db-instances List instances
aws rds create-db-cluster-snapshot Create a snapshot of a cluster
Other commands
Command Description
aws --version Show version
aws help Show help including all available commands
aws <command> help Show help for a specific command
© Nic Wortel, Software Consultant & Trainer - Last update: February 17, 2024 - Find more cheat sheets at https://nicwortel.nl/cheat-sheets
Linux Cheat Sheet
File Commands Directory Aliases File Permission Commands
Command Description Alias Directory Command Description
cat <file> Print file contents . Current directory chmod <mode> <file> Change file permissions
touch <file> Create file (or update timestamp) .. Parent directory Add execute permission for the
chmod u+x <file>
owner
cp <src> <dst> Copy a file ~ Home directory
Set file permissions to 644
mv <src> <dst> Move / rename a file chmod 644 <file> (read/write for owner, read for
rm <file> Remove file Link Commands group and everyone else)
head <file> Print first 10 lines of file Command Description Add write permission for the
chmod -R g+w <dir>
group recursively to a directory
tail <file> Print last 10 lines of file ln -s <target> <link> Create symbolic link
chown <owner> <file> Change file owner
Print last 10 lines and any new ln <target> <link> Create hard link
tail -f <file> Change directory owner
lines added to file readlink -f <file> Print absolute path of file chown -R <owner> <dir>
recursively
chown <owner>:<group>
Directory Commands Search Commands <file>
Change file owner and group
Command Description Command Description chgrp <group> <file> Change file group
ls List files in the current directory grep <pattern> <file...> Search for pattern in file(s)
ls <dir> List files in <dir> Search for pattern recursively in a File Permission Bits
grep -r <pattern> <dir>
ls -l List files with details directory Bit Description
ls -a List all files (including hidden) Search for pattern case- 4 Read (r)
grep -i <pattern> <file>
insensitively
ls -al List all files with details 2 Write (w)
Search for lines not matching
grep -v <pattern> <file>
Print the current/working pattern 1 Execute (x)
pwd
directory
grep -n <pattern> <file> Search and print line numbers
Change current directory to First digit represents the owner, the second digit represents the
cd <dir> Find files in <dir> with name group, and the third digit represents everyone else.
<dir> find <dir> -name <name>*
starting with <name>
cd .. Go up one directory For example, 640 means read/write for owner, read for group, and no
Find files in <dir> of type
find <dir> -type <type> permissions for everyone else.
mkdir <dir> Create directory <type>
Create directory and any missing
mkdir -p <dir>
parent directories File Permission User Types
Superuser Commands
cp -r <src> <dst> Copy a directory and its contents User Type Description
Command Description
mv <src> <dst> Move / rename a directory u Owner
sudo <cmd> Run command as superuser (root)
rmdir <dir> Remove an empty directory g Group
su Switch to superuser (root)
Remove a directory and its o Everyone else
rm -r <dir> su <user> Switch to user <user>
contents a All
© Nic Wortel, Software Consultant & Trainer - Last update: October 16, 2023 - Find more cheat sheets at https://nicwortel.nl/cheat-sheets
System Information Commands Secure Shell (SSH) Commands IO Redirection
Command Description Command Description Command Description
df Show file system disk usage ssh-keygen Generate SSH key pair Replace contents of file with
<cmd> > <file>
output
df -h Show disk usage in MB/GB/TB ssh-add <key> Add SSH key to SSH agent
<cmd> >> <file> Append output to file
du Show disk usage per directory ssh-add -l List SSH keys in SSH agent
<cmd> < <file> Redirect input from file
du -h Show disk usage in MB/GB/TB Copy SSH key to <host> for
ssh-copy-id <user>@<host>
<user> <cmd> 2> <file> Redirect stderr to file
free Show memory usage
Connect to <host> as current <cmd> &> <file> Redirect stdout and stderr to file
free -h Show memory usage in MB/GB/TB ssh <host>
user
uptime Show uptime ssh <user>@<host> Connect to <host> as <user>
Pipe Commands
whoami Show current user Copy local file <src> to <dest>
scp <src> <host>:<dest> Command Description
uname Show system information on <host>
<cmd1> | <cmd2> Pipe stdout to next cmd
uname -a Show all system information Copy file <src> from <host> to
scp <host>:<src> <dest>
local <dest> <cmd1> |& <cmd2> Pipe stderr to next cmd
Shutdown/Reboot Commands
APT Commands (Debian/Ubuntu) Bash Shortcuts
Command Description
Command Description Shortcut Description
Power off the system after 1
shutdown apt install <pkg> Install package Ctrl + C Stop current command
minute
shutdown now Power off the system immediately apt remove <pkg> Remove package Ctrl + A Go to beginning of line
shutdown 16:30 Power off the system at 16:30 apt purge <pkg> Remove package and config files Ctrl + E Go to end of line
shutdown -c Cancel a scheduled shutdown apt update Update package list Ctrl + K Cut current line
reboot Reboot system apt upgrade Upgrade packages Ctrl + L Clear screen
ps List processes echo <msg> Print message to stdout /bin Binary or executable programs
ps -ef List all processes man <cmd> Display manual page for <cmd> /etc System configuration files
top Display processes in real time Display history of given /home User home directories
history
commands
kill <pid> Kill process /opt Optional or third-party software
which <cmd> Find path to executable <cmd>
pkill <name> Kill process with name /tmp Temporary files
Locate binary, source, and
whereis <cmd> /usr User programs
killall <name> Kill all processes with name manual page for <cmd>
/var Variable data
/var/log Log files
© Nic Wortel, Software Consultant & Trainer - Last update: October 16, 2023 - Find more cheat sheets at https://nicwortel.nl/cheat-sheets
Terraform Cheat Sheet
© Nic Wortel, Software Consultant & Trainer - Last update: August 18, 2023 - Find more cheat sheets at https://nicwortel.nl/cheat-sheets
Terraform Cloud / Remote Authentication Conditional Expressions
Command Description Syntax Description
terraform login Log in to Terraform Cloud If condition is true, return true, otherwise return
condition ? true : false
false
terraform login <hostname> Log in to a different host
terraform logout Log out of Terraform Cloud
Splat Expressions
terraform logout <hostname> Log out of a different host
Syntax Description
Return a list of values for the given attribute of all
Managing workspaces <RESOURCE_TYPE>.<NAME>[*].<ATTRIBUTE>
instances of a resource
Command Description
terraform workspace list List all existing workspaces Resource Meta-Arguments
terraform workspace show Show the name of the current workspace Argument Description
terraform workspace select <name> Select a different workspace depends_on Explicitly specify resource dependencies
terraform workspace new <name> Create a new workspace count Create multiple instances of a resource
terraform workspace delete <name> Delete an existing workspace Create an instance of a resource for each element in
for_each
a map or set
terraform version Show the current Terraform version Create the new resource before destroying the old
create_before_destroy
one
terraform -help Show help output for Terraform
prevent_destroy Prevent Terraform from destroying the resource
terraform -help <command> Show help output for a specific Terraform command
ignore_changes Ignore changes to specific resource attributes
© Nic Wortel, Software Consultant & Trainer - Last update: August 18, 2023 - Find more cheat sheets at https://nicwortel.nl/cheat-sheets
Docker Cheat Sheet
© Nic Wortel, Software Consultant & Trainer - Last update: August 3, 2023 - Find more cheat sheets at https://nicwortel.nl/cheat-sheets
See https://docs.docker.com/engine/reference/builder/ for the full Dockerfile reference.
Dockerfile instructions
Instruction Description
Dockerfile best practices
FROM <image> Set the base image
Use the official base images from https://hub.docker.com/
FROM <image> AS <name> Set the base image and name the build stage
Use the COPY instruction instead of ADD unless you need to extract a tar file
RUN <command> Execute a command Use the COPY --chown instruction to set the owner of copied files
RUN ["exec", "param1", "param2"] Execute a command
CMD ["exec", "param1", "param2"] Execute a command when the container starts
ENTRYPOINT ["exec", "param1"] Configure the container to run as an executable
ENV <key>=<value> Set an environment variable
EXPOSE <port> Expose a port
COPY <src> <dest> Copy files from source to destination
COPY --from=<name> <src> <dest> Copy files from a build stage to destination
WORKDIR <path> Set the working directory
VOLUME <path> Create a mount point
USER <user> Set the user
ARG <name> Define a build argument
ARG <name>=<default> Define a build argument with a default value
LABEL <key>=<value> Set a metadata label
HEALTHCHECK <command> Set a healthcheck command
© Nic Wortel, Software Consultant & Trainer - Last update: August 3, 2023 - Find more cheat sheets at https://nicwortel.nl/cheat-sheets
Helm Cheat Sheet
helm repo list List all added repositories helm upgrade <name> <chart> Upgrade a release
helm repo update Update the local cache of available charts helm upgrade <name> <chart> --atomic Upgrade a release atomically
helm repo remove <name> Remove a repository helm upgrade <name> <chart>
Upgrade a release and update dependencies
--dependency-update
helm search repo List all charts in the repositories
helm upgrade <name> <chart> --version
helm search repo <keyword> Search for a chart in the repositories Upgrade a release to a specific version
<version>
helm upgrade <name> <chart> --set
Upgrade a release with specific values
Installing Helm charts <key>=<value>
Command Description helm rollback <release> <revision> Rollback a release to a previous revision
helm install <name> <chart> Install a chart with a name
helm install <chart> --generate-name Install a chart, auto-generating a name Developing charts
helm install <name> <chart> --namespace Command Description
Install a chart in a specific namespace
<namespace>
helm create <name> Create a new chart
helm install <name> <chart> --set
Install a chart with specific values
<key>=<value> helm package <chart-path> Package a chart directory into a chart file
helm install <name> <chart> --values <file> Install a chart using a values file
helm lint <chart> Lint a chart
helm install <name> <chart> --dry-run --debug Run a test installation to validate the chart
helm show all <chart> Inspect a chart and list all resources
helm install <name> <chart> --verify Verify the package before installing
helm show values <chart> Inspect a chart and show default values
helm install <name> <chart>
Update dependencies before installing
--dependency-update helm template <name> <chart> Render templates locally
helm uninstall <name> Uninstall a release
helm template <name> <chart> --set
Render templates locally and override values
helm uninstall <name> --keep-history Uninstall a release, keeping the history <key>=<value>
© Nic Wortel, Software Consultant & Trainer - Last update: December 20, 2023 - Find more cheat sheets at https://nicwortel.nl/cheat-sheets
Kubernetes Cheat Sheet
© Nic Wortel, Software Consultant & Trainer - Last update: December 20, 2023 - Find more cheat sheets at https://nicwortel.nl/cheat-sheets
Edit resources Execute commands
Command Description Command Description
kubectl edit <resource> <name> Edit a resource in a text editor kubectl exec <pod> -- <command> Execute a command in a running pod
kubectl set image <resource> <name> kubectl exec -it <pod> -- sh Open a shell in a running pod
Update the image of a container in a pod
<container>=<image>
View logs
Set labels and annotations Command Description
Command Description
kubectl logs <pod> Print the logs for a pod
kubectl label <resource> <name>
Add a label to a resource kubectl logs -f <pod> Print the logs for a pod and keep streaming
<key>=<value>
kubectl annotate <resource> <name>
Add an annotation to a resource
<key>=<value> Resource usage
Command Description
Delete resources kubectl top node Show resource (CPU/memory) usage of nodes
Command Description kubectl top pod Show resource (CPU/memory) usage of pods
kubectl delete <resource> <name> Delete a particular resource
© Nic Wortel, Software Consultant & Trainer - Last update: December 20, 2023 - Find more cheat sheets at https://nicwortel.nl/cheat-sheets