Skip to content

Instantly share code, notes, and snippets.

@twlee79
Last active March 15, 2019 00:57
Show Gist options
  • Save twlee79/2f3292822fe056390528d3df7c5e07c8 to your computer and use it in GitHub Desktop.
Save twlee79/2f3292822fe056390528d3df7c5e07c8 to your computer and use it in GitHub Desktop.

Useful commands in Linux

For copying files keeping modtime, easiest to use rsync: rync -trv [source] [target] (times, recursive, verbose) Add -n for dry-run.

For queuing tasks:

  1. Install task spooler sudo apt-get install task-spooler
  2. Queue commands with tsp {command}
  3. To mail result, add TS_MAILTO: export TS_MAILTO=address@domain
  4. Queue with different working directory and mail result: tsp -m bash -c '(pushd /dir/to/enter && {command}; popd)'

Python defaults to ASCII sys.output encoding even if terminal is UTF-8. To fix use: PYTHONIOENCODING=utf-8:surrogateescape python script.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment