Calculate genome coverage and depth from alignment
You could use samtools coverage as explained in the manual of samtoools.
Here is a example which is also described on the manual site.
samtools coverage -r chr1:1M-12M input.bam

#rname  startpos  endpos    numreads  covbases  coverage  meandepth  meanbaseq  meanmapq
chr1    1000000   12000000  528695    1069995   9.72723   3.50281    34.4       55.8