DevOps Cheat Sheet
DevOps Cheat Sheet
com/in/eebk37/
DevOps CheatSheet
Docker Cheat Sheet Helm Cheat Sheet
Kubernetes Cheat Sheet Terraform Cheat Sheet
Linux Cheat Sheet Git Cheat Sheet
AWS Cheat Sheet HTTP Cheat Sheet
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
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
Docker 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>
HTTP Cheat Sheet
Example Request & Response Request Headers Status Codes
Header Description
GET /hello.txt HTTP/1.1 A detailed list of status codes can be found in RFC 9110.
Host: www.example.com Referer: <url> The referring web page URL
User-Agent: Mozilla/5.0
Accept-Language: en, nl User-Agent: <ua>
Information about the client Status Codes: Informational
making the request
Code Description
Authorization: <scheme> Authenticate using the specified
<params> scheme and credentials The server has received the
HTTP/1.1 200 OK 100 Continue request headers and the client
Date: Mon, 27 Jul 2020 12:28:53 GMT The media types that the client should proceed
Accept: <media-types>
Server: Apache/2.2.22 can understand
The server will switch protocols to
Content-Length: 12 Accept-Encoding: The encoding algorithms the 101 Switching Protocols those defined by the response's
Content-Type: text/plain <algorithms> client understands Upgrade header field
Remove all current The age of the cached response Request fulfilled; the user agent
DELETE (idempotent) Age: <s> 205 Reset Content
representations of the resource (in sec) should reset the view
CONNECT Establish a tunnel to the server Cache-Control: Directives for caching The server has fulfilled a partial
<directives> mechanisms 206 Partial Content
GET request
Describe the communication
OPTIONS (safe, idempotent) Date/time after which the
options for the target resource Expires: <date>
response expires
Perform a message loop-back test Status Codes: Redirection
TRACE (safe, idempotent)
along the path to the resource Code Description
See RFC 9111 for detailed information about caching.
"Safe" methods are read-only and should not change the server The requested resource
300 Multiple Choices corresponds to any one of a set of
state. "Idempotent" methods can be called multiple times without
representations
different outcomes. See RFC 9110 for detailed information about
each method. The requested resource has been
301 Moved Permanently
assigned a new permanent URI
The requested resource resides
302 Found
temporarily under a different URI
Status Codes: Redirection (cont.) Status Codes: Client Error (cont.)
Code Description Code Description
A different resource can provide The requested media type is not
303 See Other 415 Unsupported Media Type
an indirect reponse supported
The resource has not been The request Range header is not
304 Not Modified 416 Range Not Satisfiable
modified since the last request satisfiable
Temporary redirect; client must The server cannot meet the
307 Temporary Redirect 417 Expectation Failed
not change the request method Expect header
Permanent redirect; client must The request was directed at a
308 Permanent Redirect
not change the request method 421 Misdirected Request server that is not able to produce
a response for this request
The server understands the
Status Codes: Client Error 422 Unprocessable Content content type but cannot process
Code Description the content
The server cannot / will not The client should switch to a
426 Upgrade Required
400 Bad Request process the request due to a different protocol
client error
The request requires user
401 Unauthorized
authentication
Status Codes: Server Error
Code Description
The server understood but refuses
403 Forbidden
the request The server encountered an
500 Internal Server Error
unexpected error
No resource was found for the
404 Not Found
request URI The server does not support the
501 Not Implemented functionality required to fulfill the
The method is not allowed for the request
405 Method Not Allowed
resource
The upstream server returned an
No representation matches the 502 Bad Gateway
406 Not Acceptable invalid response
Accept-* headers
The server is currently unable to
407 Proxy Authentication The client must authenticate with 503 Service Unavailable
handle the request
Required the proxy server
The upstream server did not
The server timed out waiting for 504 Gateway Timeout
408 Request Timeout respond in time
the request
The server does not support the
The request conflicts with the 505 HTTP Version Not Supported
409 Conflict HTTP version
current resource state
The requested resource is
410 Gone
permanently unavailable
The server requires a
411 Length Required
Content-Length header
One or more conditions evaluated
412 Precondition Failed
to false
413 Content Too Large The request content is too large
414 URI Too Long The target URI was too long
Kubernetes Cheat Sheet
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
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
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
Terraform Cheat Sheet
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