files

No ceremony here , just the operations and the damage they can do

ActionCommandSharp edge
copycp src dstoverwrites without asking
movemv src dstsame name , different meaning across devices
removerm fileno trash , no undo
makemkdir -p a/b-p stops the “exists” error
touchtouch fileupdates timestamps on existing files

A safe pattern

mkdir -p /tmp/work
printf 'one\ntwo\n' > /tmp/work/a.txt
cp /tmp/work/a.txt /tmp/work/b.txt
mv /tmp/work/b.txt /tmp/work/c.txt

The paths stay inside a throwaway directory on purpose

Permissions

chmod 600 /tmp/work/a.txt
stat -c '%a' /tmp/work/a.txt

Output:

600

Owner reads and writes Nobody else does That is the right default for anything holding a token

The mistake worth memorizing

rm -rf "$var/" with an empty var becomes rm -rf / Quote the variable and check it before destructive commands A two second check beats a very long rebuild

Next

Text processing starts in 04 text

Posted