sam to sorted bam one line code example Example: convert bam to sam samtools samtools view -h -o yourDir/test.sam test.bam