updated bashrc and created new curltime command

This commit is contained in:
tomit4 2021-08-23 10:49:30 -07:00
parent d9f2744f13
commit b4b4dc501d
3 changed files with 26 additions and 0 deletions

View file

@ -139,6 +139,13 @@ ex ()
}
# Custom Bash Commands
alias Code="cd ~/Documents/Code"
alias js="cd ~/Documents/Code/javascript"
alias c++="cd ~/Documents/Code/c++"
alias ls="ls -lah --color=auto"
alias notes="cd ~/Documents/notes"
alias firefox="firefox-developer-edition"
alias thinkorswim="/home/brian/thinkorswim/thinkorswim"
alias shutdown="shutdown -h now"
alias docs="cd ~/Documents"
alias curltime="curl -w \"@$HOME/Documents/notes/curl-format.txt\" -o /dev/null -s"

8
curl-format.txt Normal file
View file

@ -0,0 +1,8 @@
time_namelookup: %{time_namelookup}s\n
time_connect: %{time_connect}s\n
time_appconnect: %{time_appconnect}s\n
time_pretransfer: %{time_pretransfer}s\n
time_redirect: %{time_redirect}s\n
time_starttransfer: %{time_starttransfer}s\n
----------\n
time_total: %{time_total}s\n

View file

@ -9,3 +9,14 @@ curl -X DELETE http://localhost:3000/maria_database -H "Content-Type: applicatio
Simple JSON PUT request:
curl -X PUT http://localhost:3000/maria_database -H "Content-Type: application/json" -d '{"updated": "WE DID THIS IN CURL AGAIN", "previous": "DONE IN CURL"}'
#####################
Based off a Stack Overflow Post, I was able to find a way to create a command called curltime that will perform the curl command but output various timestamps regarding
how long the request/response took, this gives it a bit more functionality similar to Postman. Make sure to hang onto the curl-format.txt file in your notes and keep the
alias curltime in your .bashrc file. Then, if doing a simple GET request it's as simple as writing:
curltime http://localhost:3000/maria_database
You can easily POST, DELETE and PUT as well using it very much like curl:
curltime -X POST http://localhost:3000/maria_database -H "Content-Type: applicaton/json" -d '{"task": "DONE IN CURL"}'