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
# re-run last command!!# Re-run command N commands ago!-N
# Last parameter from previous command!$
# All params from previous command!*
Job Control
# list all jobsjobs# bring job to foregroundfg %N # where N is the job number obtained from jobs# bring job to backgroundbg %N # where N is the job number obtained from jobs
Variables
# Get cli args but only from the 2nd element and onwards"${@:2}"# Prepend Foo to every element of an array, MY_ARRAY${MY_ARRAY[@]/#/Foo}# Append Foo to every element of an array, MY_ARRAY${MY_ARRAY[@]/%/Foo}# Convert a string, referenced by MY_VAR, to lowercase"${MY_VAR,,}"
slurp file into variable
myVariable=$(<'<FILE_TO_SLURP>')
append string to files (before the extension)
# ${f%.*} - all chars before ext# ${f##*.} - all chars after ext (dot not incl)forfin*;do
mv -v "$f""${f%.*}<TEXT_TO_APPEND>.${f##*.}"done
debug
bash -x "<COMMAND_TO_RUN>"
truncate file
>'<PATH_TO_FILE>'
Recursively move files to new directory
# recursively move all MOV files in cwd to a new dir
mv ./**/*.MOV '<TARGET_DIR>'