Skip to content

Bash Cheatsheet

Login with kinit

printf $PASSWORD | kinit $USERNAME@CONTOSO.COM 
klist

Looping & IFS

IFS stands for "internal field separator". It is used by the shell to determine how to do word splitting, i. e. how to recognize word boundaries.

THINGS="foo \
bar \
baz"

for THING in THINGS; do
    echo $THING
done
IFS=';'
THINGS="foo;\
bar;\
baz"

for THING in THINGS; do
    echo $THING
done

Unset

# remove function
unset -f SomeFunction

Find

# find files in ./dir
find ./dir -type f

# find files in ./dir but not with name hidden
find ./dir -type f -not \( -name hidden \)
-maxdepth 1
-type d 
-name '*.md'
-printf "\"%p\" "