2025-12-17 07:18 UTC
There are a lot of great commands in here, so here are my favorites that I haven’t seen yet:
crontab -e
&& and || operators
“>” and >> chevrons and input/output redirection
for loops, while/if/then/else
Basic scripts
Stdin vs stdout vs /dev/null
Need to push a file out to a couple dozen workstations and then install it?
for i in $(cat /tmp/wks.txt); do echo $i; rsync -azvP /tmp/file $i:/opt/dir/; ssh -qo Connect timeout=5 $i “touch /dev/pee/pee”; done
Or script it using if else statements where you pull info from remote machines to see if an update is needed and then push the update if it’s out of date. And if it’s in a script file then you don’t have search through days of old history commands to find that one function.
Or just throw that script into crontab and automate it entirely.
Replies (0)
No replies.