Skip to content

Shell habits

Copy destination filenames explicitly

Browsers append suffixes. A file saved as config.txt copied into a directory lands as config.txt, and the service never sees it. Naming the destination file removes the ambiguity:

scp config user@host:/etc/app/config

Archives: list before extracting

tar -tf bundle.tar.gz | head

Stripping leading path components is only correct if you know how many there are. Getting it wrong scatters files into the parent directory, and cleaning that up is worse than the extra second spent looking.

Environment variables do not survive reconnection

Exported values are lost when the session ends. A command that silently expands an empty variable produces a confusing result rather than an error — checking the variable is faster than debugging the command.

echo "VALUE=[$SOME_VAR]"