{"id":21215252,"url":"https://github.com/flameshine/cheatsheet","last_synced_at":"2026-01-02T06:02:32.353Z","repository":{"id":142969473,"uuid":"523418207","full_name":"flameshine/cheatsheet","owner":"flameshine","description":"A kit of useful commands/scripts for UNIX-like systems and various concomitant tools.","archived":false,"fork":false,"pushed_at":"2025-03-04T15:50:53.000Z","size":157,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-04T16:41:15.676Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/flameshine.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-10T16:31:18.000Z","updated_at":"2025-03-04T15:50:56.000Z","dependencies_parsed_at":"2023-11-21T15:49:53.903Z","dependency_job_id":"4f9c6919-4681-460b-a7e9-b3be54a93f9c","html_url":"https://github.com/flameshine/cheatsheet","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flameshine%2Fcheatsheet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flameshine%2Fcheatsheet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flameshine%2Fcheatsheet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flameshine%2Fcheatsheet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flameshine","download_url":"https://codeload.github.com/flameshine/cheatsheet/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243664431,"owners_count":20327470,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-20T21:35:38.047Z","updated_at":"2026-01-02T06:02:32.346Z","avatar_url":"https://github.com/flameshine.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cheatsheet\n\n\u003ch2\u003eTable of contents\u003c/h2\u003e\n\n* [Utilities](#Utilities)\n* [Unix](#Unix)\n* [Helm](#Helm)\n* [Kubernetes](#Kubernetes)\n* [Docker](#Docker)\n* [AWS](#AWS)\n  * [ECR](#ECR)\n  * [EKS](#EKS)\n  * [S3](#S3)\n  * [Secrets](#Secrets)\n* [Redis](#Redis)\n* [argo-workflows](#argo-workflows)\n* [Git](#Git)\n* [SVN](#SVN)\n* [git-crypt](#git-crypt)\n* [Gradle](#Gradle)\n* [Maven](#Maven)\n* [Python](#Python)\n\n\u003ch2\u003eUtilities\u003c/h2\u003e\n\nUML Diagram Builder: https://app.diagrams.net\n\nAWS Policy Generator: https://awspolicygen.s3.amazonaws.com/policygen.html\n\nAWS Pricing Calculator: https://calculator.aws\n\nUnicode Converter: https://www.branah.com/unicode-converter\n\nJSON Converter: https://jsontostring.com\n\nDifference Checker: https://www.diffchecker.com\n\nEpoch Time Converter: https://www.epochconverter.com\n\nRandom Number Generator: https://www.random.org\n\nTypeScript Playground: https://www.typescriptlang.org/play\n\nRegEx Shaper: https://regexr.com\n\nCharacter Remover: https://onlinecaseconvert.com/remove-characters-from-text-online.php\n\nCase Converter: https://convertcase.net\n\nCharacter Counter: https://charactercalculator.com\n\n\u003ch2\u003eUnix\u003c/h2\u003e\n\nChange group permission of a file:\n\n```\nsudo chown \u003cuser\u003e:contractors \u003ctarget\u003e\n```\n\nKill a process on particular port:\n\n```\nsudo kill -9 $(lsof -t -i:\u003cport\u003e)\n```\n\nCheck what is running on the port:\n\n```\nlsof -i -P | grep \"LISTEN\" | grep:\u003cport\u003e\n```\n\nGet SSL certificate data:\n\n```\nopenssl crl2pkcs7 -nocrl -certfile \u003cname\u003e | openssl pkcs7 -print_certs -noout\n```\n\nGrep all '.gz' files in directory:\n\n```\nfind . -name \\*.gz -print0 | xargs -0 zgrep \"\u003cpattern\u003e\"\n```\n\nGenerate a random string:\n\n```\nLC_ALL=C \u003c /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c32; echo\n```\n\nEncode a string with Base64:\n\n```\nopenssl base64 -e \u003c\u003c\u003c \"\u003cstring\u003e\"\n```\n\nDecode a string with Base64:\n\n```\nopenssl base64 -d \u003c\u003c\u003c \"\u003cstring\u003e\"\n```\n\nGet your IP address:\n\n```\nifconfig | grep \"inet \" | grep -Fv 127.0.0.1 | awk '{print $2}'\n```\n\nFind file and replace all occurrences of a string inside:\n\n```\nfind . -name \"\u003cpattern\u003e\" -print0 | xargs -0 sed -i \"\" 's/\u003cold\u003e/\u003cnew\u003e/g'\n```\n\nArchive applying a passcode:\n\n```\nzip -er \u003carchive-name\u003e \u003carchive-target\u003e\n```\n\nAdd space to the volume:\n\n```\nsudo vgdisplay rootvg\n\nsudo growpart /dev/nvme0n1 3\n\nsudo lvextend -L +2G /dev/mapper/rootvg-usrlv\n\nsudo xfs_growfs /usr\n```\n\n\u003ch2\u003e\u003ca href=\"https://helm.sh/\"\u003eHelm\u003c/a\u003e\u003c/h2\u003e\n\nGenerate template:\n\n```\nhelm template \u003cpath-to-chart\u003e -f \u003cvalues-to-pass\u003e \u003e ~/template.yaml\n```\n\n\u003ch2\u003e\u003ca href=\"https://kubernetes.io/\"\u003eKubernetes\u003c/a\u003e\u003c/h2\u003e\n\nList namespace events:\n\n```\nkc -n \u003cnamespace\u003e get events\n```\n\nEnter a specific pod:\n\n```\nkc exec --stdin --tty \u003cpod\u003e -- /bin/bash\n```\n\nExecute a command inside a pod:\n\n```\nkc -n \u003cnamespace\u003e exec \u003cpod\u003e \u003ccommand\u003e\n```\n\nCreate an ordinary job from a cronjob:\n\n```\nkc create job --from=cronjob/\u003ccronjob\u003e \u003cname\u003e\n```\n\nGet resource YAML definition:\n\n```\nkc get \u003cresource\u003e \u003cname\u003e -o yaml\n```\n\nForward pod's requests to a local port:\n\n```\nkc -n \u003cnamespace\u003e port-forward \u003cpod\u003e 8080:80\n```\n\nView the exact yaml of some Kubernetes component:\n\n```\nkc get \u003cresource\u003e \u003cname\u003e -o yaml | less\n```\n\nApply the corresponding action to each listed pod:\n\n```\nkc -n \u003cnamespace\u003e get pods | awk '{print $1}' | grep \"\u003cpattern\u003e\" | xargs kubectl -n \u003cnamespace\u003e \u003caction\u003e pod\n```\n\nScale the deployment:\n\n```\nkc -n \u003cnamespace\u003e scale deployment/\u003cdeployment\u003e --replicas=\u003cnumber of replicas\u003e\n```\n\n\u003ch2\u003e\u003ca href=\"https://www.docker.com/\"\u003eDocker\u003c/a\u003e\u003c/h2\u003e\n\nRemove all stopped containers, networks not used by at least one container, all images without at least one container and all build cache:\n\n```\ndocker system prune -a\n```\n\nBuild an image with tag:\n\n```\ndocker build -t \u003ctag\u003e \u003cpath\u003e\n```\n\nRemove the last container:\n\n```\ndocker ps -a | awk '{print $1}' | sed -n 2p | xargs docker rm\n```\n\n\u003ch2\u003e\u003ca href=\"https://aws.amazon.com\"\u003eAWS\u003c/a\u003e\u003c/h2\u003e\n\n\u003ch3\u003e\u003ca href=\"https://aws.amazon.com/en/ecr\"\u003eECR\u003c/a\u003e\u003c/h3\u003e\n\nLogin into ECR:\n\n```\naws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin \u003cECR address\u003e\n```\n\n\u003ch3\u003e\u003ca href=\"https://aws.amazon.com/en/eks\"\u003eEKS\u003c/a\u003e\u003c/h3\u003e\n\nUpdate EKS cluster config:\n\n```\naws eks update-kubeconfig --profile \u003cprofile\u003e --region \u003cregion\u003e --name \u003ccluster-name\u003e\n```\n\n\u003ch3\u003e\u003ca href=\"https://aws.amazon.com/en/s3\"\u003eS3\u003c/a\u003e\u003c/h3\u003e\n\nGet the total number of objects in a bucket:\n\n```\naws s3 ls s3://\u003cbucket\u003e --recursive --summarize | grep \"Total Objects:\"\n```\n\n\u003ch3\u003e\u003ca href=\"https://aws.amazon.com/en/secrets-manager\"\u003eSecrets Manager\u003c/a\u003e\u003c/h3\u003e\n\nDelete a secret immediately:\n\n```\naws secretsmanager delete-secret --secret-id \u003csecret-id\u003e --force-delete-without-recovery\n```\n\n\u003ch2\u003e\u003ca href=\"https://redis.io\"\u003eRedis\u003c/a\u003e\u003c/h2\u003e\n\nConnect to the cluster:\n\n```\nredis6-cli -c -h \u003chost\u003e -p \u003cport\u003e\n```\n\nGet N items matching a pattern:\n\n```\nscan 0 match \u003cpattern\u003e count \u003ccount\u003e\n```\n\n\u003ch2\u003e\u003ca href=\"https://argoproj.github.io/workflows\"\u003eargo-workflows\u003c/a\u003e\u003c/h2\u003e\n\nSubmit a template:\n\n```\nargo -n \u003cnamespace\u003e template create \u003cpath\u003e\n```\n\nSubmit a workflow:\n\n```\nargo -n \u003cnamespace\u003e submit \u003cpath\u003e\n```\n\nDelete a template:\n\n```\nargo -n \u003cnamespace\u003e template delete template \u003cname\u003e\n```\n\nDelete a workflow:\n\n```\nargo -n \u003cnamespace\u003e delete workflow \u003cname\u003e\n```\n\n\u003ch2\u003e\u003ca href=\"https://git-scm.com\"\u003eGit\u003c/a\u003e\u003c/h2\u003e\n\nReset the branch:\n\n```\ngit reset --hard origin\n```\n\nSquash all commits on a branch:\n\n```\ngit checkout \u003cbranch\u003e\n\ngit reset $(git merge-base master $(git branch --show-current))\n\ngit add -A\n\ngit commit -m \u003cmessage\u003e\n\ngit push --force\n```\n\nMove unpushed commit from one branch to another:\n\n```\ngit reset HEAD~1\n\ngit stash\n\ngit checkout \u003cbranch\u003e\n\ngit stash pop\n```\n\nRevert particular file:\n\n```\ngit checkout HEAD^ \u003cpath\u003e\n```\n\nCherry-pick commit from another repository:\n\n```\ngit remote add other \u003clink\u003e\n\ngit fetch other\n\ngit cherry-pick \u003chash\u003e\n\ngit remote remove other\n```\n\nSquash certain commit:\n\n```\ngit rebase -i master\n\npick -\u003e squash (for the commits you're interested in)\n```\n\nSplit a certain commit:\n\n```\ngit rebase -i \u003ccommit\u003e\n\npick -\u003e edit (for the commits you're interested in)\n\ngit reset HEAD~\n\ngit rebase --continue\n```\n\nSave changes from a range of commits for a single file into a patch:\n\n```\ngit diff HEAD~3 HEAD~1 -- path/to/file.ext \u003e changes.patch\n```\n\n\u003ch2\u003e\u003ca href=\"https://subversion.apache.org\"\u003eSVN\u003c/a\u003e\u003c/h2\u003e\n\nGet the latest revision before the new branch was created:\n\n```\nsvn log --stop-on-copy --verbose --limit 1 -r0:HEAD \u003cbranch-link\u003e\n```\n\nDefine a format a file:\n\n```\nsvn propset svn:mime-type \u003cformat\u003e \u003cpath\u003e\n```\n\n\u003ch2\u003e\u003ca href=\"https://github.com/AGWA/git-crypt\"\u003egit-crypt\u003c/a\u003e\u003c/h2\u003e\n\nInstructions: https://github.com/AGWA/git-crypt/tree/master\n\nLock repository:\n\n```\ngit-crypt lock\n```\n\nUnlock repository:\n\n```\ngit-crypt unlock \u003ckey path\u003e\n```\n\n\u003ch2\u003eGradle\u003c/h2\u003e\n\nBuild refreshing dependencies:\n\n```\n./gradlew build --refresh-dependencies\n```\n\n\u003ch2\u003eMaven\u003c/h2\u003e\n\nClean, build and refresh all dependencies:\n\n```\nmvn clean install -U\n```\n\nDisplay dependency tree:\n\n```\nmvn dependency:tree\n```\n\n\u003ch2\u003e\u003ca href=\"https://www.python.org\"\u003ePython\u003c/a\u003e\u003c/h2\u003e\n\nStart an HTTP server:\n\n```\npython3 -m http.server \u003cport\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflameshine%2Fcheatsheet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflameshine%2Fcheatsheet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflameshine%2Fcheatsheet/lists"}