# What is a quick way to find the reverse complement in bash

I have a DNA sequence of which I would like to quickly find the reverse complement. Is there a quick way of doing this on the bash command line using only GNU tools?

Thanks to Manu Tamminen for this solution:

echo ACCTTGAAA | tr ACGTacgt TGCAtgca | rev

• And if I want to put it into a variable instead of echo it? – Adi Ro Jan 6 at 9:44
• I would enclose the code in \$() and assign to a variable assuming you are using a recent version of bash. – winni2k Jan 6 at 11:35
• that works thanks! – Adi Ro Jan 9 at 9:29

Reverse complement FASTA/Q:

seqtk seq -r in.fa > out.fa


https://github.com/lh3/seqtk

You may either install the emboss package (http://emboss.sourceforge.net/download/) and use the revseq program. It contains many useful command-line programs such as the pairwise alignment tool needle.