useful cli commands

usefuel cli commands #

rsync #

1rsync --append-verify -avzP \
2-e "ssh -i /path/to/priv_key -p 31245" \
3username@192.0.2.1:/path/to/data/ /local/path
  • The exemplary command is for downloading from the remote machine. To upload, simply change the order of the paths (so first the local path, than the remote path).
  • If ssh access exists, rsync can transfer files to the remote machine. I like to use it, because it can continue from where it stopped, e.g. if it was interrupted. Therefore the argument –append-verify is used.

sed for cleaning fasta header names #

1 sed -e '/^>/ s/ .*\|\t.*//' -e '/^>/ s/|/_/' /path/to/fasta-file.fasta > /path/to/fasta-file.cleaned_header_names.fasta
  • This keeps only the first characters in the header lines, before a space or a tab. It does also replaces | with _. I use it to clean the headers of genome assembly files. The GNU sed live editor helped me with coming up with this command.