You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bring in functions from another .sh file in a location relative to the script you're running
source${dir}/otherfunctions.sh
base64 encode latest item on clipboard
pbpaste | base64
base64 decode latest item on clipboard
pbpaste | base64 -d
netcat (nc) check port on host
# -z (scan for port, without sending any data)# -v (verbose)
nc -zv google.com 80
telnet check port on host
telnet google.com 80
Save output of command to a file
# Set the command to an environemnt variable (this helps preserve whitespaces and newlines etc.)
TEMP=`kubectl -n my_namespace get events --sort-by=.metadata.creationTimestamp | grep fail`# Now echo this env var to a file making sure to wrap it in double quotesecho"$TEMP">> output.txt
Show all installed versions of Java (Mac)
/usr/libexec/java_home -V
or
mdfind -name 'java'| grep '/bin/java$'
Find a given string in sh files
find . -name '*.sh' -exec grep "some string you want to find" {} \;