Skip to content

Instantly share code, notes, and snippets.

@jorgedfbranco
Last active December 2, 2018 19:14
Show Gist options
  • Save jorgedfbranco/70037bcc314d4c4a4810096dd5b91f48 to your computer and use it in GitHub Desktop.
Save jorgedfbranco/70037bcc314d4c4a4810096dd5b91f48 to your computer and use it in GitHub Desktop.

Bash Cheat Sheet

curl

  • Pass in username/password: -u username:password, to use github tokens, curl -u 2346b76ab68d28071961d15e96e89d09614bec97:x-oauth-basic
  • Passing in HTTP headers: -h "A: B", such as -h "Autorization: bearer ABC
  • Post a message in the body of curl: --data "contents" or -d "contents"
  • curl will by default assume it's dealing with a GET, unless a -d is passed in, then being considered a POST. To explicitly state which request method you want, you can pass in -X PUT, -X HEAD, etc.
  • Follow redirects: -L
  • Avoid reporting download information: -s
  • Extra information: -v, -i
  • curl --limit-rate 50b 127.0.0.1:8080/random to limit the rate to 50b/s

netstat

  • sudo netstat -tupln shows you which ports are currently being used and by which application

Encoding / Decoding

  • Encode a file in base-64: base64 <file>
  • Decode a string: base64 -d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment